﻿// JScript File
 function productMsg(producttype,productamount)
   {
      // alert("hi");
    // alert("producttype="+ producttype + "productamount="+productamount); 
   // alert(productamount);
      if(producttype="POA")
      {
        document.getElementById('POAlbl').innerText="You will be contacted shortly, by a member of our customer <BR>"+
        "service team to confirm the total price of products(s)<br>selected";
      }
      else
       {
         document.getElementById('lbladdproduct').innerText="<b>The value of additional products added to this case is $ " +  parseFloat(productamount).toFixed(2) + " inclusive of VAT</b>";
         }
       
   }
function GoFunctionality()
{   
    if((document.getElementById("txtSearchInput").value =="") || (document.getElementById("txtSearchInput").value =="Search the site"))
     {  
		document.getElementById("lblSearchMsg").style.display="inline";
        document.getElementById("txtSearchInput").focus();
        return false;
     } 
   else 
   {
        var strSearch = document.getElementById('txtSearchInput').value;
        document.getElementById("lblSearchMsg").style.display="none";
        if(strSearch != "" && strSearch != 'Search the site')
        {
            win=window.open("../Common/SearchPage.aspx?strSearch="+strSearch+"",'win','toolbars=no,scrollbars=yes,resizable=no,width=650,height=600');
            popWidth=650;
            popHeight=600;
            screenW = screen.width;
            screenH = screen.height;
            xPos= ((screenW - (popWidth+4))/2);
            yPos= ((screenH - (popHeight+20))/2);
            win.moveTo(xPos,yPos);
        }
        else
        {
            return false;
        }
   }   
   return true;
}

function GoFunction(strSearch)
{   
    strSearch = document.getElementById("txtSearch").value;   
    //  document.getElementById("lblUserMsg1").style.display="none";
    if((document.getElementById("txtSearch").value =="") || (document.getElementById("txtSearch").value =="Search the site"))
     {  
		document.getElementById("lblSearchMsg").style.display="inline";
        document.getElementById("txtSearch").focus();
        return false;
     }
     else
     {
       document.getElementById("lblSearchMsg").style.display="none";             
       
       win=window.open("Common/SearchPage.aspx?strSearch="+strSearch+"",'win','toolbars=no,scrollbars=yes,resizable=no,width=650,height=600');
       popWidth=650;
       popHeight=600;
       screenW = screen.width;
       screenH = screen.height;
       xPos= ((screenW - (popWidth+4))/2);
       yPos= ((screenH - (popHeight+20))/2);
       win.moveTo(xPos,yPos);
       return false;
    }
}

function keyPressEnter(evt)
{   
    
    var charCode = (evt.which) ? evt.which : event.keyCode    
    if (charCode == 13)
    {       
       GoFunction('test');
       return false;
    }
}

function keyPressEnterInp(evt)
{       
    var charCode = (evt.which) ? evt.which : event.keyCode    
    if (charCode == 13)
    {
       GoFunctionality('testinput');       
       return false;
    }
}

function TrimAll(sString) 
{
    while (sString.substring(0,1) == ' ')
    {
    sString = sString.substring(1, sString.length);
    }
    while (sString.substring(sString.length-1, sString.length) == ' ')
    {
    sString = sString.substring(0,sString.length-1);
    }
    return sString;
}
function ClearSearchText()
{
    //alert(document.getElementById('txtSearchInput'));       
   
//    if(document.getElementById('txtSearchInput') != null && TrimAll(document.getElementById('txtSearchInput').value) =='Search the site')
//    {
//        document.getElementById('txtSearchInput').value = "";
//        return;
//    } 
    if(TrimAll(document.getElementById('txtSearch').value) == 'Search the site')
    {
        //alert('asdasd');
        //document.getElementById('txtSearch').value = "";
        document.getElementById('txtSearch').select();        
    } 
    
    
}

function RetainSearchText()
{
//    if(document.getElementById('txtSearchInput') != null && TrimAll(document.getElementById('txtSearchInput').value) == '')
//    {
//        document.getElementById('txtSearchInput').value = 'Search the site';
//        return;
//    } 
    if(TrimAll(document.getElementById('txtSearch').value) == '')
    {
        //alert('asdasd');
        //alert('came into wrong if condt');
        document.getElementById('txtSearch').value = 'Search the site';
    } 
        

}

function ClearSearchInputText()
{   
   
    if(document.getElementById('txtSearchInput') != null && TrimAll(document.getElementById('txtSearchInput').value) =='Search the site')
    {
        //document.getElementById('txtSearchInput').value = "";
        document.getElementById('txtSearchInput').select();
        return;
    } 
}

function RetainSearchInputText()
{
    if(document.getElementById('txtSearchInput') != null && TrimAll(document.getElementById('txtSearchInput').value) == '')
    {
        document.getElementById('txtSearchInput').value = 'Search the site';
        return;
    } 
}
    
  
 function ClearUserText()
{
    //alert(document.getElementById('txtSearchInput'));       
   
    if(document.getElementById('txtUser') != null && TrimAll(document.getElementById('txtUser').value) =='User Name')
    {
        document.getElementById('txtUser').value = "";
        return;
    } 
    if(TrimAll(document.getElementById('txtUser').value) == 'User Name')
    {
      
        document.getElementById('txtUser').value = "";
    } 
    
    
}

function RetainUserText()
{
    if(document.getElementById('txtUser') != null && TrimAll(document.getElementById('txtUser').value) == 'User Name')
    {
       document.getElementById('txtUser').value = 'User Name';
       return;
    } 
    if(TrimAll(document.getElementById('txtUser').value) == '')
    {
        
        document.getElementById('txtUser').value = 'User Name';
    } 
        

}
function ClearPasswordText()
{
    //alert(document.getElementById('txtSearchInput'));       
   
    if(document.getElementById('txtPassword') != null && TrimAll(document.getElementById('txtPassword').value) =='Password')
    {
        document.getElementById('txtPassword').value = "";
        return;
    } 
    if(TrimAll(document.getElementById('txtPassword').value) == 'Password')
    {
      
        document.getElementById('txtPassword').value = "";
    } 
    
    
}

function RetainPasswordText()
{
    if(document.getElementById('txtPassword') != null && TrimAll(document.getElementById('txtPassword').value) == 'Password')
    {
       document.getElementById('txtPassword').value = 'Password';
       return;
    } 
    if(TrimAll(document.getElementById('txtPassword').value) == '')
    {
        
       document.getElementById('txtPassword').value = 'Password';
    } 
}

 function visiblePassword()
    {
        document.getElementById('txtPassword').style.display = 'inline';
        document.getElementById('txtPassword').focus();
        document.getElementById('txtPasswordText').style.display = 'none';
    }
    function visiblePasswordTextbox()
    {
        if(document.getElementById('txtPassword').value.length == 0)
        {
            document.getElementById('txtPasswordText').style.display = 'inline';
            document.getElementById('txtPassword').style.display = 'none';
        }
    }

    

