﻿// JScript File
var intpageCount
function CheckPageF()
{   
    var txtPage = document.getElementById('_ctl0_TxtGoF');
    var varcount=txtPage.value; 
    if(varcount=='')
    {
        alert("Please enter the value");	
        txtPage.focus();	     
        return false;
    }        
    if(!IsNumeric(varcount))
    {
        alert("Please enter the numeric only");		      
        txtPage.focus();
        return false;
    }
    if(varcount==0)	
    {
        alert("Please enter the value 1 to " + intpageCount);
        txtPage.focus();
        return false;
    }                                
    if(varcount>intpageCount)	
    {
        alert("Please enter the value 1 to " + intpageCount);
        txtPage.focus();
        return false;
    }	    
} 
function IsNumeric(strString)
//  check for valid numeric strings	
{
var strValidChars = "0123456789.-";
var strChar;
var blnResult = true;

if (strString.length == 0) return false;

//  test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
  {
  strChar = strString.charAt(i);
  if (strValidChars.indexOf(strChar) == -1)
     {
     blnResult = false;
     }
  }
return blnResult;
}


function Showcomment(id)
{
	for(i=0;i< intItem;i++)
	{ 
	    if(id==1)
	    {
	        eval("document.getElementById('ImageDisplay" + i + "').style.display=\"\"");
            eval("document.getElementById('_ctl0_HdText')").value=1;
	    }
	    else
	    {
	        eval("document.getElementById('ImageDisplay" + i + "').style.display=\"none\"");
            eval("document.getElementById('_ctl0_HdText')").value=2;
	    
	    }

     }
     listText();
 }

function doAlert(imb)
{            
    txtbx1 = imb.name.replace("ibtAddCart","txtQuantity");
    hdbx1 = imb.name.replace("ibtAddCart","hdQuantity");
      hdbx2 = imb.name.replace("ibtAddCart","hdMinQuantity");
    txtbx =txtbx1.replace(/:/g,"_");
    hdbx =hdbx1.replace(/:/g,"_");
      hdminbx =hdbx2.replace(/:/g,"_");
    tbQty = eval("document.getElementById('"+ txtbx + "')");
    hdQty = eval("document.getElementById('"+ hdbx + "')");
     hdMinQty = eval("document.getElementById('"+ hdminbx + "')");
    
     if(tbQty.value=="")
    {
        alert("Enter Quantity");
        tbQty.focus();
        return false;
    }
    if(isNaN(tbQty.value))
    {
        alert("Enter Numeric Values Only");
        tbQty.value.value="";
        tbQty.focus();
        return false;
    }
    if(parseInt(tbQty.value)<1)
    {
        alert("Quantity Must Be Greater than Zero");
        tbQty.value="";
        tbQty.focus();
        return false;
    }
    old=hdQty.value;
    newqun=tbQty.value
    if(parseInt(old)<parseInt(newqun))
    {
         
        alert("Available Quantity is Only "+ old);
        tbQty.value="";
        tbQty.focus();
        return false;
    }
     if(parseInt(tbQty.value)<parseInt(hdMinQty.value))
    {
        alert("Min Quantity to add this Item is: "+hdMinQty.value);
        tbQty.value="";
        tbQty.focus();
        return false;
    }
   
}
	
function listText()
{
        var view=document.getElementById('_ctl0_HdText').value;
        if(view==1)
        {
            document.getElementById('imgList').src="/images/list-on.gif";
            document.getElementById('imgText').src="/images/text.gif";
         }
         else
         {
            document.getElementById('imgList').src="/images/list.gif";
            document.getElementById('imgText').src="/images/text-on.gif";
         }

} 
function showcomments(imgid,img1)
{
    //DisplayDummy();
	var tp = document.all?eval("document.getElementById('"+imgid+"')").parentElement.parentElement.offsetTop-10:eval("document.getElementById('"+imgid+"')").parentNode.parentNode.offsetTop ;
	var lft = document.all?eval("document.getElementById('"+imgid+"')").parentElement.parentElement.offsetLeft+150:eval("document.getElementById('"+imgid+"')").parentNode.parentNode.offsetLeft+150;
	document.getElementById('popproduct').style.top = tp+"px";
	document.getElementById('popproduct').style.left = lft+"px";
	document.getElementById('popproduct').style.visibility = "visible";
	gid = document.all?eval("document.getElementById('"+imgid+"')").parentElement.parentElement.id.replace("ImageDisplay",""):eval("document.getElementById('"+imgid+"')").parentNode.parentNode.id.replace("ImageDisplay","");
	//alert(document.getElementById('TextDisplay'+gid).innerHTML.replace('class=proddesc','class=proddescvisible'))
	pid = eval("document.getElementById('_ctl0_DLSubCategory__ctl"+gid+"_price')")?eval("document.getElementById('_ctl0_DLSubCategory__ctl"+gid+"_price')"):eval("document.getElementById('_ctl0_DLSubCategory__ctl"+gid+"_saleprice')") ;
	document.getElementById('popproduct').innerHTML="<table border='0' cellpadding='0' cellspacing='0' ><tr><td><img src='/images/left-top-corner-move.png' style='border:0px;' /></td><td  style='background-image:url(/images/top-move.png);'></td><td><img src='/images/right-top-corner-move.png' style='border:0px;'/></td></tr><tr><td  style='background-image:url(/images/left-move.png);'></td><td align='center'><table border='0' cellpadding='0' cellspacing='0'  bgcolor='#ffffff' style='padding:5px;'><tr><td><img src=\"/productimage/big/"+img1+"\"></td></tr><tr><td align='left'>"+ eval("document.getElementById('TextDisplay"+gid+"')").innerHTML.replace('class=proddesc','')+"</td></tr><tr><td height=5></td></tr><tr><td align='left'>"+pid.innerHTML+"</td></tr><tr><td height=5></td></tr></table></td><td  style='background-image:url(/images/right-move.png);'></td></tr><tr><td><img src='/images/left-bottom-corner-move.png' style='border:0px;' /></td><td  style='background-image:url(/images/bottom-move.png);'></td><td><img src='/images/right-bottom-corner-move.png' style='border:0px;' /></td></tr></table>"	
}
function showcommentsclose()
{
    document.getElementById('popproduct').style.visibility="hidden";
}       
function showFilter(id)
{
    eval("document.getElementById('Filter')").style.display="";
    eval("document.getElementById('_ctl0_dvPrice')").style.display="none";
     switch(id)
     {
     case 1:
            eval("document.getElementById('_ctl0_dvPrice')").style.display="";
             document.getElementById('_ctl0_imgPrice').src="/images/price-on.gif";
            break;
     }
     eval("document.getElementById('_ctl0_HdView')").value=id;    
}

function showFilterSelected()
{
    var id=eval("document.getElementById('_ctl0_HdView')").value;  
     switch(id)
     {
     case '1':      
            eval("document.getElementById('Filter')").style.display="";
            eval("document.getElementById('_ctl0_dvPrice')").style.display="";    
             document.getElementById('_ctl0_imgPrice').src="/images/price-on.gif";           
            break;
          
     }     
     Showcomment(eval("document.getElementById('_ctl0_HdText')").value);
}