﻿// JScript File
function nextimage()
{
//alert(parseInt(document.getElementById("hdncount").value));
if(parseInt(document.getElementById("hdncount").value)<2)
document.getElementById("hdncount").value=parseInt(document.getElementById("hdncount").value)+1;
if(parseInt(document.getElementById("hdncount").value)==0)
{
document.getElementById("prev").src="images/icons/best-seller-back-disabled.gif";
document.getElementById("next").src="images/icons/best-seller-next.gif";
}
else if(parseInt(document.getElementById("hdncount").value)==2)
{
document.getElementById("prev").src="images/icons/best-seller-back.gif";
document.getElementById("next").src="images/icons/best-seller-next-disabled.gif";
}
else
{
document.getElementById("prev").src="images/icons/best-seller-back.gif";
document.getElementById("next").src="images/icons/best-seller-next.gif";

}
if(parseInt(document.getElementById("hdncount").value)==0)
{
document.getElementById("one").src="images/icons/best-seller-current.gif";
document.getElementById("two").src="images/icons/best-seller.gif"
document.getElementById("three").src="images/icons/best-seller.gif"
}
if(parseInt(document.getElementById("hdncount").value)==1)
{
document.getElementById("one").src="images/icons/best-seller.gif";
document.getElementById("two").src="images/icons/best-seller-current.gif"
document.getElementById("three").src="images/icons/best-seller.gif"
}
if(parseInt(document.getElementById("hdncount").value)==2)
{
document.getElementById("one").src="images/icons/best-seller.gif";
document.getElementById("two").src="images/icons/best-seller.gif"
document.getElementById("three").src="images/icons/best-seller-current.gif"
}


var obj1=document.getElementById("imgimage");
var produtname=document.getElementById("productname");
var authorname=document.getElementById("authorname");
var price=document.getElementById("price");
var addcart=document.getElementById("addcart");
var wishlist=document.getElementById("wishlist");
var productdetail=document.getElementById("hdnimages").value;
var productimage=document.getElementById("prodimage");

var imagearry=productdetail.split("!");
var productarr;
for (i=0;i < (imagearry.length);i++)
{
    productarr=imagearry[i].split("*");
    if(parseInt(document.getElementById("hdncount").value)==i)
    {
        obj1.src=productarr[0];
        obj1.alt=productarr[11];
        obj1.title=productarr[11];
        produtname.innerHTML=productarr[1];
          produtname.href=productarr[2];
          
        authorname.innerHTML=productarr[3];
       // alert(productarr[10])
        if(productarr[9]!="" && productarr[10]!="")
         authorname.href=productarr[4];
         else
         authorname.href="#";
        price.innerHTML=productarr[5];
       
          if(productarr[6]=="Y")
          addcart.href=productarr[7];
          else
          addcart.innerHTML="Out Of Stock";
          wishlist.href=productarr[8];
          productimage.href=productarr[2];
     }
}
//alert(document.getElementById("hdncount").value);
//alert(document.getElementById("hdncount").value);
}
function previmage()
{
if(parseInt(document.getElementById("hdncount").value)>0)
document.getElementById("hdncount").value=parseInt(document.getElementById("hdncount").value)-1;

if(parseInt(document.getElementById("hdncount").value)==0)
{
document.getElementById("prev").src="images/icons/best-seller-back-disabled.gif";
document.getElementById("next").src="images/icons/best-seller-next.gif";
}

else if(parseInt(document.getElementById("hdncount").value)==2)
{
document.getElementById("prev").src="images/icons/best-seller-back.gif";
document.getElementById("next").src="images/icons/best-seller-next-disabled.gif";
}
else
{
document.getElementById("prev").src="images/icons/best-seller-back.gif";
document.getElementById("next").src="images/icons/best-seller-next.gif";

}
if(parseInt(document.getElementById("hdncount").value)==0)
{
document.getElementById("one").src="images/icons/best-seller-current.gif";
document.getElementById("two").src="images/icons/best-seller.gif"
document.getElementById("three").src="images/icons/best-seller.gif"
}
if(parseInt(document.getElementById("hdncount").value)==1)
{
document.getElementById("one").src="images/icons/best-seller.gif";
document.getElementById("two").src="images/icons/best-seller-current.gif"
document.getElementById("three").src="images/icons/best-seller.gif"
}
if(parseInt(document.getElementById("hdncount").value)==2)
{
document.getElementById("one").src="images/icons/best-seller.gif";
document.getElementById("two").src="images/icons/best-seller.gif"
document.getElementById("three").src="images/icons/best-seller-current.gif"
}

var obj1=document.getElementById("imgimage");
var produtname=document.getElementById("productname");
var authorname=document.getElementById("authorname");
var price=document.getElementById("price");
var addcart=document.getElementById("addcart");
var wishlist=document.getElementById("wishlist");
var productimage=document.getElementById("prodimage");

var productdetail=document.getElementById("hdnimages").value;
var imagearry=productdetail.split("!");
var productarr;
for (i=0;i < (imagearry.length);i++)
{
    productarr=imagearry[i].split("*");
    if(parseInt(document.getElementById("hdncount").value)==i)
    {
       obj1.src=productarr[0];
       obj1.alt= productarr[11];
         obj1.title= productarr[11]; 
        produtname.innerHTML=productarr[1];
          produtname.href=productarr[2];
        authorname.innerHTML=productarr[3];
         if(productarr[9]!="" && productarr[10]!="")
         authorname.href=productarr[4];
         else
         authorname.href="#";
        price.innerHTML=productarr[5];
          if(productarr[6]=="Y")
          addcart.href=productarr[7];
          else
          addcart.innerHTML="Out Of Stock";
          wishlist.href=productarr[8];
            productimage.href=productarr[2];
     }
}
//alert(document.getElementById("hdncount").value);
//alert(document.getElementById("hdncount").value);

}

//code for comming soon
function nextcimage()
{
if(parseInt(document.getElementById("hdnbestcount1").value)<parseInt(document.getElementById("hdnctotal").value)-1)
document.getElementById("hdnbestcount1").value=parseInt(document.getElementById("hdnbestcount1").value)+1;
if(parseInt(document.getElementById("hdnbestcount1").value)==0)
{
document.getElementById("cprev").src="images/icons/best-seller-back-disabled.gif";
document.getElementById("cnext").src="images/icons/best-seller-next.gif";
}
else if(parseInt(document.getElementById("hdnbestcount1").value)==(parseInt(document.getElementById("hdnctotal").value)-1))
{
document.getElementById("cprev").src="images/icons/best-seller-back.gif";
document.getElementById("cnext").src="images/icons/best-seller-next-disabled.gif";
}
else if(parseInt(document.getElementById("hdnbestcount1").value)==(parseInt(document.getElementById("hdnctotal").value)))
{
document.getElementById("cprev").src="images/icons/best-seller-back.gif";
document.getElementById("cnext").src="images/icons/best-seller-next-disabled.gif";
}
else
{
document.getElementById("cprev").src="images/icons/best-seller-back.gif";
document.getElementById("cnext").src="images/icons/best-seller-next.gif";

}
for(k=0;k< parseInt(document.getElementById("hdnctotal").value);k++)
{
    if(k==parseInt(document.getElementById("hdnbestcount1").value))
    document.getElementById("Imgc"+(parseInt(k)+1)).src="images/icons/comming-soon-current.gif";
    else if(parseInt(document.getElementById("hdnctotal").value) == parseInt(document.getElementById("hdnbestcount1").value))
    document.getElementById("Imgc"+(parseInt(k+1))).src="images/icons/comming-soon-current.gif";
    else
    document.getElementById("Imgc"+(parseInt(k)+1)).src="images/icons/comming-soon.gif"
}
var obj1=document.getElementById("cproductimage");
var produtname=document.getElementById("cproductname");
var authorname=document.getElementById("cauthorname");
var price=document.getElementById("cproductprice");
//var addcart=document.getElementById("bestaddtocart");
var wishlist=document.getElementById("caddtowishlist");
var productdetail=document.getElementById("hdncommingsoon").value;
var productimage=document.getElementById("cproductlink");
//var bestsellerimage=document.getElementById("bestsellerimage");
//var outofstock=document.getElementById("outofstock");
var imagearry=productdetail.split("!");
var productarr;
var count;
for (i=0;i < (imagearry.length);i++)
{
    productarr=imagearry[i].split("*");
    if(parseInt(document.getElementById("hdnbestcount1").value)==i)
    { //alert(productarr[6]);

        obj1.src=productarr[0];
        obj1.alt=productarr[12];
       obj1.title=productarr[12]; 
        produtname.innerHTML=productarr[1];
          produtname.href=productarr[2];
        authorname.innerHTML=productarr[3];
        if(productarr[11]!="" && productarr[10]!="")
         authorname.href=productarr[4];
         else
         authorname.href="#";
         
        price.innerHTML=productarr[5];
          wishlist.href=productarr[8];
          productimage.href=productarr[2];
          count=productarr[9];
     }
}
}
function prevcimage()
{

if(parseInt(document.getElementById("hdnbestcount1").value)>0)
    document.getElementById("hdnbestcount1").value=parseInt(document.getElementById("hdnbestcount1").value)-1;
    
if(parseInt(document.getElementById("hdnbestcount1").value)==0)
{
document.getElementById("cprev").src="images/icons/best-seller-back-disabled.gif";
document.getElementById("cnext").src="images/icons/best-seller-next.gif";
}

else if(parseInt(document.getElementById("hdnbestcount1").value)==(parseInt(document.getElementById("hdnctotal").value)-1))
{
document.getElementById("cprev").src="images/icons/best-seller-back.gif";
document.getElementById("cnext").src="images/icons/best-seller-next-disabled.gif";
}
else if(parseInt(document.getElementById("hdnbestcount1").value)==(parseInt(document.getElementById("hdnctotal").value)))
{
document.getElementById("cprev").src="images/icons/best-seller-back.gif";
document.getElementById("cnext").src="images/icons/best-seller-next-disabled.gif";
}
else
{
document.getElementById("cprev").src="images/icons/best-seller-back.gif";
document.getElementById("cnext").src="images/icons/best-seller-next.gif";

}
for(k=0;k< parseInt(parseInt(document.getElementById("hdnctotal").value));k++)
{
    if(k==parseInt(document.getElementById("hdnbestcount1").value))
    document.getElementById("Imgc"+(parseInt(k)+1)).src="images/icons/comming-soon-current.gif";
    else if(parseInt(document.getElementById("hdnctotal").value)== parseInt(document.getElementById("hdnbestcount1").value))
  document.getElementById("Imgc"+(parseInt(k)-1)).src="images/icons/comming-soon-current.gif";
    else
    document.getElementById("Imgc"+(parseInt(k)+1)).src="images/icons/comming-soon.gif"
}
var obj1=document.getElementById("cproductimage");
var produtname=document.getElementById("cproductname");
var authorname=document.getElementById("cauthorname");
var price=document.getElementById("cproductprice");
//var addcart=document.getElementById("addcart");
var wishlist=document.getElementById("caddtowishlist");
var productimage=document.getElementById("cproductlink");

var productdetail=document.getElementById("hdncommingsoon").value;
var imagearry=productdetail.split("!");
var productarr;
for (i=0;i < (imagearry.length);i++)
{
    productarr=imagearry[i].split("*");
    if(parseInt(document.getElementById("hdnbestcount1").value)==i)
    {
       obj1.src=productarr[0];
        obj1.alt=productarr[11];
         obj1.title=productarr[11];
        produtname.innerHTML=productarr[1];
          produtname.href=productarr[2];
        authorname.innerHTML=productarr[3];
         if(productarr[9]!="" && productarr[10]!="")
         authorname.href=productarr[4];
         else
         authorname.href="#";
        price.innerHTML=productarr[5];
//          if(productarr[6]=="Y")
//          addcart.href=productarr[7];
//          else
//          addcart.innerHTML="Out Of Stock";
          wishlist.href=productarr[8];
            productimage.href=productarr[2];
     }
}
}
//end of comming sooin

//best seller
function bestseller1()
{
if(parseInt(document.getElementById("hdnbestcount").value)<parseInt(document.getElementById("hdntotal").value)-1)
document.getElementById("hdnbestcount").value=parseInt(document.getElementById("hdnbestcount").value)+1;
if(parseInt(document.getElementById("hdnbestcount").value)==0)
{
document.getElementById("bestback").src="images/icons/best-seller-back-disabled.gif";
document.getElementById("bestnext").src="images/icons/best-seller-next.gif";
}

else if(parseInt(document.getElementById("hdnbestcount").value)==(parseInt(document.getElementById("hdntotal").value)-1))
{
document.getElementById("bestback").src="images/icons/best-seller-back.gif";
document.getElementById("bestnext").src="images/icons/best-seller-next-disabled.gif";
}
else if(parseInt(document.getElementById("hdnbestcount").value)==(parseInt(document.getElementById("hdntotal").value)))
{
document.getElementById("bestback").src="images/icons/best-seller-back.gif";
document.getElementById("bestnext").src="images/icons/best-seller-next-disabled.gif";
}
else
{
document.getElementById("bestback").src="images/icons/best-seller-back.gif";
document.getElementById("bestnext").src="images/icons/best-seller-next.gif";

}
for(k=0;k< parseInt(document.getElementById("hdntotal").value);k++)
{
    if(k==parseInt(document.getElementById("hdnbestcount").value))
    document.getElementById("best"+(parseInt(k)+1)).src="images/icons/best-seller-current.gif";
    else if(parseInt(document.getElementById("hdntotal").value)==parseInt(document.getElementById("hdnbestcount").value))
    document.getElementById("best"+(parseInt(k+1))).src="images/icons/best-seller-current.gif";
  else
    document.getElementById("best"+(parseInt(k)+1)).src="images/icons/best-seller.gif"
}
var obj1=document.getElementById("productimage");
var produtname=document.getElementById("bestproductname");
var authorname=document.getElementById("bestauthorname");
var price=document.getElementById("bestprice");
var addcart=document.getElementById("bestaddtocart");
var wishlist=document.getElementById("bestwishlist");
var productdetail=document.getElementById("hdnbestimage").value;
var productimage=document.getElementById("productlink");
var bestsellerimage=document.getElementById("bestsellerimage");
var outofstock=document.getElementById("outofstock");
var imagearry=productdetail.split("!");
var productarr;
var count;
for (i=0;i < (imagearry.length);i++)
{
    productarr=imagearry[i].split("*");
    if(parseInt(document.getElementById("hdnbestcount").value)==i)
    { //alert(productarr[6]);

        obj1.src=productarr[0];
        obj1.alt=productarr[12];
        obj1.title=productarr[12];
        produtname.innerHTML=productarr[1];
          produtname.href=productarr[2];
        authorname.innerHTML=productarr[3];
        if(productarr[11]!="" && productarr[10]!="")
         authorname.href=productarr[4];
         else
         authorname.href="#";
         
        price.innerHTML=productarr[5];
          if(productarr[6]=="Y")
          { bestsellerimage.style.display=""
          addcart.href=productarr[7];
          outofstock.innerHTML="";
          }
          else
          { bestsellerimage.style.display="none"
           outofstock.innerHTML="Out Of Stock";
            addcart.href="#";
          }
          wishlist.href=productarr[8];
          productimage.href=productarr[2];
          count=productarr[9];
     }
}

}
//end of best seller

function bestseller()
{
    if(parseInt(document.getElementById("hdnbestcount").value)>0)
    document.getElementById("hdnbestcount").value=parseInt(document.getElementById("hdnbestcount").value)-1;
    
    if(parseInt(document.getElementById("hdnbestcount").value)==0)
{
document.getElementById("bestback").src="images/icons/best-seller-back-disabled.gif";
document.getElementById("bestnext").src="images/icons/best-seller-next.gif";
}

else if(parseInt(document.getElementById("hdnbestcount").value)==(parseInt(document.getElementById("hdntotal").value)-1))
{
document.getElementById("bestback").src="images/icons/best-seller-back.gif";
document.getElementById("bestnext").src="images/icons/best-seller-next-disabled.gif";
}
else
{
document.getElementById("bestback").src="images/icons/best-seller-back.gif";
document.getElementById("bestnext").src="images/icons/best-seller-next.gif";

}
for(k=0;k< parseInt(parseInt(document.getElementById("hdntotal").value));k++)
{
    if(k==parseInt(document.getElementById("hdnbestcount").value))
    document.getElementById("best"+(parseInt(k)+1)).src="images/icons/best-seller-current.gif";
    else
    document.getElementById("best"+(parseInt(k)+1)).src="images/icons/best-seller.gif"
}

var obj1=document.getElementById("productimage");
var produtname=document.getElementById("bestproductname");
var authorname=document.getElementById("bestauthorname");
var price=document.getElementById("bestprice");
var addcart=document.getElementById("bestaddtocart");
var wishlist=document.getElementById("bestwishlist");
var productdetail=document.getElementById("hdnbestimage").value;
var productimage=document.getElementById("productlink");
var bestsellerimage=document.getElementById("bestsellerimage");
var outofstock=document.getElementById("outofstock");
var imagearry=productdetail.split("!");
var productarr;
var count;
for (i=0;i < (imagearry.length);i++)
{
    productarr=imagearry[i].split("*");
    if(parseInt(document.getElementById("hdnbestcount").value)==i)
    {// alert(productarr[6]);
        obj1.src=productarr[0];
        obj1.alt=productarr[12];
        obj1.title=productarr[12];
        produtname.innerHTML=productarr[1];
          produtname.href=productarr[2];
        authorname.innerHTML=productarr[3];
         authorname.href=productarr[4];
        price.innerHTML=productarr[5];
          if(productarr[6]=="Y")
          {
       //   bestsellerimage.src="images/btn-addtocart.png";
          addcart.href=productarr[7];
          bestsellerimage.style.display="";
          outofstock.innerHTML="";
          }
          else
          {
             bestsellerimage.style.display="none";
         outofstock.innerHTML="Out Of Stock";
            addcart.href="#";
          }
          wishlist.href=productarr[8];
          productimage.href=productarr[2];
          count=productarr[9];
     }
}
}
    function ChangePage1(id)
			 {
			    // alert(id);
				document.getElementById("hdnvalue").value = id;
				__doPostBack('lnkupdate','');
			
			 }
			 function showdiv()
			 {
			 document.getElementById("div1").style.display="block";
			 document.getElementById("div2").style.display="none";
			 }
			  function showdiv1()
			 {
			 document.getElementById("div2").style.display="block";
			  document.getElementById("div1").style.display="none";
			 }
 function CodeBehindDDlJs(e)
{
    if(window.event)
    {
     evt_code=event.keyCode;
    }
    else if(e.which)
    {
    evt_code=e.which;
    }
    if(evt_code==13)
    {
    if(trim(document.getElementById("txtSearch").value)!="")
    document.getElementById("imgsearch").src="images/btn-search-hover.png"
    document.getElementById('imgsearch').click();
    return false;
    }
 }
 function validatename()
 {
   if(trim(document.getElementById("txtsubsname").value)=="name")
   {
   document.getElementById("txtsubsname").value="";
   return false;
   }
 }
  function validatename1()
 {
   if(trim(document.getElementById("txtsubsname").value)=="")
   {
   document.getElementById("txtsubsname").value="name";
   return false;
   }
 }
 function validateemail()
 {
   if(trim(document.getElementById("txtsubsemail").value)=="email")
   {
   document.getElementById("txtsubsemail").value="";
   return false;
   }
 }
  function validateemail1()
 {
   if(trim(document.getElementById("txtsubsemail").value)=="")
   {
   document.getElementById("txtsubsemail").value="email";
   return false;
   }
 }
 function validatesearch()
 {
   if(trim(document.getElementById("txtSearch").value)=="keyword")
   {
   document.getElementById("txtSearch").value="";
   return false;
   }
 }
  function validatesearch1()
 {
   if(trim(document.getElementById("txtSearch").value)=="")
   {
   document.getElementById("txtSearch").value="keyword";
   return false;
   }
 }
 function hovereffect()
 {
 document.getElementById("imgsearch").src="images/btn-search-hover.png"
 }
  function hovereffect1()
 {
 document.getElementById("imgsearch").src="images/btn-search.png"
 }



