﻿// Archivo JScript

function clearAll(){
    var texts=document.getElementsByTagName('input');
    for (var i_tem = 0; i_tem < texts.length; i_tem++)
    {
        if (texts[i_tem].type=='text')
            texts[i_tem].value='';      
    }     
     
    var texts=document.getElementsByTagName('textarea');
    for (var i_tem = 0; i_tem < texts.length; i_tem++)
    {
        texts[i_tem].value='';      
    }     
     
     return false;
}

function onHover(obj)
{
    obj.style.background = '#666666';
    //obj.style.borderBottom = '1px solid #666666';
    obj.style.color = 'white';
}

function onNoHover(obj, color)
{
    obj.style.background = color;
    //obj.style.borderBottom = '1px solid ' + color;
    obj.style.color = '#4d4d4d';
}

function printIt(printThis, pedido)
  {
    var win = window.open();
    
    self.focus();
    win.document.open();
    win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>');
    win.document.write('body, td { font-family: Calibri, Arial; font-size: 14pt;}');
    win.document.write('<'+'/'+'style'+'>');
     win.document.write('<title>Pedido Mémora.es</title>');
     win.document.write('<link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />');   
     win.document.write('<'+'/'+'head'+'><'+'body'+'>');
     win.document.write('<div>Pedido: ')
     win.document.write(pedido);
     win.document.write('</div><br />');
    win.document.write(printThis);
    win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>');
    win.document.close();
    win.print();
    win.close();
  }



var objImage;

function popup(url) 
{
    objImage = new Image();
    objImage.src=url;

    imageLoaded(url);
}

// function invoked on image load
function imageLoaded(url)
{    
    if (objImage.complete) {
        
         var width  = objImage.width;
         var height = objImage.height;
         var left   = (screen.width  - width)/2;
         var top    = (screen.height - height)/2;
         var params = 'width='+width+', height='+height;
         params += ', top='+top+', left='+left;
         params += ', directories=no';
         params += ', location=no';
         params += ', menubar=no';
         params += ', resizable=no';
         params += ', scrollbars=no';
         params += ', status=no';
         params += ', toolbar=no';
         params += ', modal=yes';
          params += ', centerscreen=yes';
         
        if (window.showModalDialog) 
        {
            window.showModalDialog('popup.htm?' + url,"Image","dialogWidth:"+width+"px;dialogHeight:"+height+"px;center:yes;scroll:no;status:no;");
        } else {
            newwin=window.open('popup.htm?' + url,'Image', params);
            if (window.focus) {newwin.focus()}
        }
         
     }
    else {
        window.setTimeout("imageLoaded('"+url+"')", 500);
    } 
}


function modalWin(obj) 
{    
    if (window.showModalDialog) 
    {
        window.showModalDialog(obj.href,"name","dialogWidth:700px;dialogHeight:630px;center:yes;scroll:no;status:no;");
    } else {
        window.open(obj.href,'name','height=630,width=70,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no, centerscreen=yes, modal=yes');
    }
}

