﻿var intpageCount
var imgObj1=new Image();
imgObj1.src='/images/shape-on.gif';
var imgObj2=new Image();
imgObj2.src='/images/color-on.gif';
var imgObj3=new Image();
imgObj3.src='/images/price-on.gif';
var imgObj4=new Image();
imgObj4.src='/images/grid-on.gif';
var imgObj5=new Image();
imgObj5.src='/images/list-on.gif';
var imgObj6=new Image();
imgObj6.src='/images/text-on.gif';
var imgObj7=new Image();
imgObj7.src='/images/text.gif';
var imgObj8=new Image();
imgObj8.src='/images/list.gif';
var imgObj9=new Image();
imgObj9.src='/images/price.gif';
var imgObj10=new Image();
imgObj10.src='/images/color.gif';
var imgObj11=new Image();
imgObj11.src='/images/shape.gif';
var imgObj12=new Image();
imgObj12.src='/images/grid.gif';

var imgMouseOver1=new Image();
imgMouseOver1.src='/images/bigrotation2.gif';
var imgMouseOver2=new Image();
imgMouseOver2.src='/images/bottom-move.png';
var imgMouseOver3=new Image();
imgMouseOver3.src='/images/right-bottom-corner-move.png';
var imgMouseOver4=new Image();
imgMouseOver4.src='/images/left-bottom-corner-move.png';
var imgMouseOver5=new Image();
imgMouseOver5.src='/images/right-move.png';
var imgMouseOver6=new Image();
imgMouseOver6.src='/images/left-move.png';
var imgMouseOver7=new Image();
imgMouseOver7.src='/images/top-move.png';

var imgMouseOver8=new Image();
imgMouseOver8.src='/images/right-top-corner-move.png';
var imgMouseOver9=new Image();
imgMouseOver9.src='/images/left-top-corner-move.png';
var timeoff;
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=="" ||tbQty.value==" ")
    {
        alert("Enter Quantity");
        tbQty.focus();
        return false;
    }
    if(isNaN(tbQty.value))
    {
        alert("Enter Numeric Values Only");
        tbQty.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 doSort()
{
	for(i=0;i<intItem;i++)
	{
	    var idhd=document.getElementById('_ctl0_HdView').value;
	    if(idhd==0)
	    {
	         eval("document.getElementById('_ctl0_DLSubCategory__ctl" + i + "_divShape').style.display=\"none\"");
	         eval("document.getElementById('_ctl0_DLSubCategory__ctl" + i + "_divColor').style.display=\"none\"");
             document.getElementById('_ctl0_imgShape').src="/images/shape.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color.gif";
             document.getElementById('_ctl0_imgPrice').src="/images/price.gif";
	    }
		else if(idhd==1)
		{
	         eval("document.getElementById('_ctl0_DLSubCategory__ctl" + i + "_divShape').style.display=\"none\"");
	         eval("document.getElementById('_ctl0_DLSubCategory__ctl" + i + "_divColor').style.display=\"\"");
             document.getElementById('_ctl0_imgShape').src="/images/shape.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color-on.gif";
             document.getElementById('_ctl0_imgPrice').src="/images/price.gif";
        }  
		else if(idhd==2)	
		{	
		
	         eval("document.getElementById('_ctl0_DLSubCategory__ctl" + i + "_divShape').style.display=\"\"");
	         eval("document.getElementById('_ctl0_DLSubCategory__ctl" + i + "_divColor').style.display=\"none\"");
             document.getElementById('_ctl0_imgShape').src="/images/shape-on.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color.gif";
             document.getElementById('_ctl0_imgPrice').src="/images/price.gif";
		      
		}
        else if(idhd==3)
        {
	         eval("document.getElementById('_ctl0_DLSubCategory__ctl" + i + "_divShape').style.display=\"none\"");
	         eval("document.getElementById('_ctl0_DLSubCategory__ctl" + i + "_divColor').style.display=\"none\"");
             document.getElementById('_ctl0_imgShape').src="/images/shape.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color.gif";
             document.getElementById('_ctl0_imgPrice').src="/images/price-on.gif";
        }
        
    }	
}		
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 DisplayDummy()
{
    clearTimeout(timeoff);
}
function showcommentsimage(imgid,img1)
{
	var tp1 = document.all?eval("document.getElementById('"+imgid+"')").parentElement.parentElement.offsetTop-10:eval("document.getElementById('"+imgid+"')").parentNode.parentNode.offsetTop ;
	var lft1 = document.all?eval("document.getElementById('"+imgid+"')").parentElement.parentElement.offsetLeft+150:eval("document.getElementById('"+imgid+"')").parentNode.parentNode.offsetLeft+150;
	document.getElementById('popproduct').style.top = tp1+"px";
	document.getElementById('popproduct').style.left = lft1+"px";
	document.getElementById('popproduct').style.visibility = "visible";
	gid1 = 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'))
	pid1 = eval("document.getElementById('_ctl0_DLSubCategory__ctl"+gid1+"_price')")?eval("document.getElementById('_ctl0_DLSubCategory__ctl"+gid1+"_price')"):eval("document.getElementById('_ctl0_DLSubCategory__ctl"+gid1+"_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"+gid1+"')").innerHTML.replace('class=proddesc','')+"</td></tr><tr><td height=5></td></tr><tr><td align='left'>"+pid1.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";
    clearTimeout(timeoff);
}       
function showFilter(id)
{
    eval("document.getElementById('Filter')").style.display="";
    eval("document.getElementById('_ctl0_ddColor')").style.display="none";
    eval("document.getElementById('_ctl0_dvPrice')").style.display="none";
     eval("document.getElementById('_ctl0_dvShape')").style.display="none";
     switch(id)
     {
     case 1:
            eval("document.getElementById('_ctl0_ddColor')").style.display="";
            eval("document.getElementById('_ctl0_dvPrice')").style.display="none";
            eval("document.getElementById('_ctl0_dvShape')").style.display="none";  
            document.getElementById('_ctl0_imgShape').src="/images/shape.gif";
            document.getElementById('_ctl0_imgColor').src="/images/color-on.gif";
            document.getElementById('_ctl0_imgPrice').src="/images/price.gif";          
            break;
     case 2:
            eval("document.getElementById('_ctl0_ddColor')").style.display="none";
            eval("document.getElementById('_ctl0_dvPrice')").style.display="none";
            eval("document.getElementById('_ctl0_dvShape')").style.display="";
            document.getElementById('_ctl0_imgShape').src="/images/shape-on.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color.gif";
             document.getElementById('_ctl0_imgPrice').src="/images/price.gif";
            break;
     case 3:
            eval("document.getElementById('_ctl0_ddColor')").style.display="none";
            eval("document.getElementById('_ctl0_dvPrice')").style.display="";
            eval("document.getElementById('_ctl0_dvShape')").style.display="none";
            document.getElementById('_ctl0_imgShape').src="/images/shape.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color.gif";
             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_ddColor')").style.display="";
            eval("document.getElementById('_ctl0_dvPrice')").style.display="none";
            eval("document.getElementById('_ctl0_dvShape')").style.display="none"; 
            document.getElementById('_ctl0_imgShape').src="/images/shape.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color-on.gif";
             document.getElementById('_ctl0_imgPrice').src="/images/price.gif";          
            break;
     case '2':      
            eval("document.getElementById('Filter')").style.display="";    
            eval("document.getElementById('_ctl0_ddColor')").style.display="none";
            eval("document.getElementById('_ctl0_dvPrice')").style.display="none";
            eval("document.getElementById('_ctl0_dvShape')").style.display="";
            document.getElementById('_ctl0_imgShape').src="/images/shape-on.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color.gif";
             document.getElementById('_ctl0_imgPrice').src="/images/price.gif";            
            break;
     case '3':      
            eval("document.getElementById('Filter')").style.display="";
            eval("document.getElementById('_ctl0_ddColor')").style.display="none";
            eval("document.getElementById('_ctl0_dvPrice')").style.display="";
            eval("document.getElementById('_ctl0_dvShape')").style.display="none"; 
            document.getElementById('_ctl0_imgShape').src="/images/shape.gif";
             document.getElementById('_ctl0_imgColor').src="/images/color.gif";
             document.getElementById('_ctl0_imgPrice').src="/images/price-on.gif";           
            break;
          
     }     
     Showcomment(eval("document.getElementById('_ctl0_HdText')").value);
}
