﻿// JScript File
function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   DoSearch(); //myfield.form.submit();
   return false;
   }
else
   return true;
}

function OpenVideoFile(IdProduct)
{
window.open("ShowVideo.aspx?IdProduct=" + IdProduct, "ShowVideoFile","status=0,location=0,menubar=1,resizable=1,width=350,height=330"); 
}
function FormatCep(e,src,mask) 
{
    if(window.event) { _TXT = e.keyCode; } 
    else if(e.which) { _TXT = e.which; }
    if(_TXT > 47 && _TXT < 58) { 
    var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i);
    if (texto.substring(0,1) != saida) { src.value += texto.substring(0,1); } 
    return true; } else { if (_TXT != 8) { return false; } 
    else { return true; }
    }
}
    function OpenBoleto(myFormAction) 
    {
    var myForm = document.forms["aspnetForm"];
    var w = window.open('about:blank','Popup_Window','width=700,height=500,scrollbars=yes');
    myForm.action = myFormAction;
    myForm.method = 'post';
    myForm.target = 'Popup_Window';
    myForm.submit();
    //return true;
    }
function SetProductImage(Img, ImgFull)
{
   document.getElementById("ctl00_ContentPlaceHolder1_Image1").src=Img;
   document.getElementById("ctl00_ContentPlaceHolder1_LnkImgShow").href=ImgFull;
}

function star_over(num)
    {
        for(var i=1;i<=num;i++)
        {
            if (document.getElementById("star"+i).src.indexOf("starRed")<0)
            {
                if (i<=num)
                {
                    document.getElementById("star"+i).src = "images/starGold.gif";
                }
                else
                {
                    document.getElementById("star"+i).src = "images/starWhite.gif";
                }
             }
         }
    }
    
function star_out()
    {
        if (document.getElementById("star1").src.indexOf("starRed")<0)
        {
            document.getElementById("star1").src = "images/starGold.gif";
            for(var i=2;i<=5;i++)
            {
                if (document.getElementById("star"+i).src.indexOf("starRed")<0)
                document.getElementById("star"+i).src = "images/starWhite.gif";
            }
         }
    }
function star_click(num)
    {
    document.getElementById("ctl00_ContentPlaceHolder1_HdnReviewNote").value = num;
    for(var i=1;i<=5;i++)
        {
            if (i<=num)
            {
                document.getElementById("star"+i).src = "images/starRed.gif";
            }   
            else
            {
                document.getElementById("star"+i).src = "images/starWhite.gif";
            }
        }
    }
function DoSearch()
{
window.location = "Search.aspx?q=" + document.getElementById("q").value;
}
    


