﻿// javascript for header drop down
function CurrencySelection(loc)
{       if (loc=="EUR")
        {
        document.getElementById('EUR').style.backgroundColor='#cccccc';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';
        }
        else if (loc=="GBP")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#cccccc';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';
        }
        else if (loc=="CAD")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#cccccc';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';
        }
        else if (loc=="AUD")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#cccccc';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';

        }
        else if (loc=="INR")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#cccccc';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';

        }
        else if (loc=="USD")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#cccccc';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';
        }
        else if (loc=="MYR")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#cccccc';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';
        }
        else if (loc=="NZD")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#cccccc';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';
        }
        else if (loc=="AED")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#cccccc';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';
        }
        else if (loc=="PKR")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#cccccc';
        document.getElementById('ZAR').style.backgroundColor='#ffffff';
        }
        else if (loc=="ZAR")
        {
        document.getElementById('EUR').style.backgroundColor='#ffffff';
        document.getElementById('GBP').style.backgroundColor='#ffffff';
        document.getElementById('CAD').style.backgroundColor='#ffffff';
        document.getElementById('AUD').style.backgroundColor='#ffffff';
        document.getElementById('INR').style.backgroundColor='#ffffff';
        document.getElementById('USD').style.backgroundColor='#ffffff';
        document.getElementById('MYR').style.backgroundColor='#ffffff';
        document.getElementById('NZD').style.backgroundColor='#ffffff';
        document.getElementById('AED').style.backgroundColor='#ffffff';
        document.getElementById('PKR').style.backgroundColor='#ffffff';
        document.getElementById('ZAR').style.backgroundColor='#cccccc';
        }
}
var CurrDropDown = 0;
var Noteloc;
function SetSecCurrlistDropDown(loc) {
	
	CurrDropDown = GetSetSecCurr();
	var checktt = 0;
checktt = new Date().getTime();
	if (CurrDropDown == null) {alert("Your browser does not support AJAX!");return;	}
	var url = 0;
	if (loc == "") {url = "../store/currencydropdown.aspx";	}
	else if (loc == "HOME") {url = "store/currencydropdown.aspx";}
	else{url = "store/currencydropdown.aspx";}
	url = url + "?loc=" + loc;
	url = url + "&chkt=" + checktt;
	Noteloc=loc;
	CurrDropDown.onreadystatechange = stateChangedSetDropCur;
	CurrDropDown.open("GET", url, true);
	CurrDropDown.send(null);
}
function stateChangedSetDropCur() {	
if (CurrDropDown.readyState == 4) {document.getElementById('currencydropdown').innerHTML = CurrDropDown.responseText;}
}
var SetSecCurr;
function SetSecCurrlist(curname) {
	SetSecCurr = GetSetSecCurr();
	var checkt = 0;
	var url;
	checkt = new Date().getTime();
	if (SetSecCurr == null) {alert("Your browser does not support AJAX!");return;}
	if (Noteloc == "") {url = "../include/set-sec-currency.aspx";}
	else {url = "include/set-sec-currency.aspx";}
	url = url + "?currency=" + curname;
	url = url + "&loc=header";
	url = url + "&icode=nocode";
	url = url + "&chkt=" + checkt;
	SetSecCurr.onreadystatechange = stateChangedSetSecCurr;
	SetSecCurr.open("GET", url, true);
	SetSecCurr.send(null);
}

function stateChangedSetSecCurr() {
	if (SetSecCurr.readyState == 4) {
		document.getElementById('Shortcurrencylist').style.display = 'none';
		document.getElementById('currencyChangemsg').style.display = '';
		document.getElementById('currencyChangemsg').innerHTML = SetSecCurr.responseText;
		setTimeout("location.reload(true);", 3000);
	}
}

function GetSetSecCurr() {
	var SetSecCurr = null;
	try {
		// Firefox, Opera 8.0+, Safari
		SetSecCurr = new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			SetSecCurr = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			SetSecCurr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return SetSecCurr;
}
//Currency List
function ShowCurrencylisting(mouse) {
	if (mouse == "OVER") {
		document.getElementById('currencyChangemsg').style.display = 'none'
		document.getElementById('Shortcurrencylist').style.display = ''
	}
	else {document.getElementById('Shortcurrencylist').style.display = 'none'}
}
//Currency List end

//********Showtab start*******


 var xmlHttpobj2;
function showitemtab(x,d)
{ 
xmlHttpobj2=GetXmlHttpObject2();

if (xmlHttpobj2==null) { alert ("Your browser does not support AJAX!"); return; } 
var url="store/producttab.aspx";
xmlHttpobj2.onreadystatechange=stateChanged2;
xmlHttpobj2.open("GET",url,true);
xmlHttpobj2.send(null);
clearTimeout(timerTab);
}

function stateChanged2() 
{ 
if (xmlHttpobj2.readyState==4){ document.getElementById("sareetab").innerHTML=xmlHttpobj2.responseText;  showTab(1,''); }
else
	 {document.getElementById("sareetab").innerHTML="<table cellpadding=0 cellspacing=0 border=0 height='200px' width='700' style='vertical-align:top;padding:10px 0 0 10px'><tr><td width='700' height='200px' valign='top'><img src='images/loadingcircle.gif' width='16' height='16' alt='' /><span class=carttext> Requesting content...</span><br><img src='images/spacer.gif' width='750' height='16' alt=''></td></tr></table>" }
}
function GetXmlHttpObject2()
{var xmlHttpobj2=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttpobj2=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttpobj2=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttpobj2=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttpobj2;
}

// Retrieve page End
// Rated items page End
 var xmlHttpobj3;
function showrateditems(){ 
xmlHttpobj3=GetXmlHttpObject2();
if (xmlHttpobj3==null) { alert ("Your browser does not support AJAX!"); return; } 
var url="store/rateditems.aspx";
xmlHttpobj3.onreadystatechange=stateChanged3;
xmlHttpobj3.open("GET",url,true);
xmlHttpobj3.send(null);
clearTimeout(timerratedTab);}

function stateChanged3() 
{ if (xmlHttpobj3.readyState==4){document.getElementById("rateditems").innerHTML=xmlHttpobj3.responseText;}
else{document.getElementById("rateditems").innerHTML="<table cellpadding=0 cellspacing=0 border=0 height='200px' width='700' style='vertical-align:top;padding:10px 0 0 10px'><tr><td width='700' height='200px' valign='top'><img src='images/loadingcircle.gif' width='16' height='16' alt='' /><span class=carttext> Requesting content...</span><br><img src='images/spacer.gif' width='750' height='16' alt=''></td></tr></table>" }
}
function GetXmlHttpObject3()
{var xmlHttpobj3=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttpobj3=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {xmlHttpobj3=new ActiveXObject("Msxml2.XMLHTTP");}
  catch (e)
    {xmlHttpobj3=new ActiveXObject("Microsoft.XMLHTTP");}
  }
return xmlHttpobj3;
}
// Rated items page End

// START tab box timing show function //
var y
var timerID = 0;
var timerTab = 0;
var timerratedTab=0;
var d;
var z=0;
var ch="";

function showTab(x,d)
{
    ch=d;
    document.getElementById('Div1').style.display="none";
    document.getElementById('Div2').style.display="none";
    document.getElementById('Div3').style.display="none";
    document.getElementById('Div4').style.display="none";
    document.getElementById('Div5').style.display="none";
    document.getElementById('Div6').style.display="none";
    document.getElementById('Div'+x).style.display="";
    document.getElementById('NA'+x).style.background=""; 
    if(z!=0)
    { document.getElementById('NA'+z).style.background="url('images/light-pink.jpg') repeat";
      document.getElementById('NA'+z).style.borderBottom="1px solid #B6B4B4"; 
    }
    document.getElementById('NA'+x).style.borderBottom="none"; 
    z=x;
    if (x==6)
	{ y=1 ;}
    else
	{ y=x+1; }
    clearTimeout(timerID);
    timerID=0;
    timerID = setTimeout("showTab(y,'')", 5000);
}
function stopTimer() {
window.clearTimeout(timerID);
}
function MOver(N)
{ 
document.getElementById(N).style.textDecoration='underline'; 
document.getElementById(N).style.background="none";
}
function temp(vv)
{
  document.getElementById(vv).style.background="background-color: white";
  ch='';
}
function MOut(N)
{
 document.getElementById(N).style.textDecoration='';
  if(ch=='')
  {
 document.getElementById(N).style.background="url('images/light-pink.jpg') repeat";
  }
 if(ch=='c')
 temp(N)
 }
// END tab box timing show function //
function showitemtab2()
{
timerTab = setTimeout("showitemtab(1,'')", 2000);
}
function showitemtab3()
{
timerratedTab = setTimeout("showrateditems(1,'')", 2000);
}

// START image tab box timing show function //
var N
var timerimageID = 0;
var k=0;
function showimageTab(x)
{
document.getElementById('Div11').style.display="none";
document.getElementById('Div12').style.display="none";
document.getElementById('Div13').style.display="none";
document.getElementById('Div14').style.display="none";
document.getElementById('Div15').style.display="none";
document.getElementById('Div1'+x).style.display="";
document.getElementById('image'+x).style.border="4px solid #7e0023"; 
if(k!=0)
{document.getElementById('image'+k).style.border="4px solid #ffffff";}
k=x;
if (x==5)
	{ N=1 ;}
else{ N=x+1; }
clearTimeout(timerimageID);
timerimageID=0;
timerimageID = setTimeout("showimageTab(N)", 5000);
}
function MimageOver(N)
{ document.getElementById(N).style.border="4px solid #7e0023"; }
function MimageOut(N){document.getElementById(N).style.border="4px solid #ffffff";}

// END imagetab box timing show function //

function showhead(page)
{
var cname;
var page;
cname=get_cookie('custname');
if(cname!=null)
{
document.getElementById("fwsigncust").innerHTML=cname;
document.getElementById("fwsigncust").className="redprice";
document.getElementById("fwsigncust").style.paddingLeft=5;
    if(page=='y')
        { document.getElementById("fwsign").innerHTML=" ,  <a href='loginform.aspx' title='My Account'>My Account<\/a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href='logout.aspx' title='Sign Out'>Sign Out<\/a>";}
    else
        {document.getElementById("fwsign").innerHTML=" ,  <a href='store/loginform.aspx' title='My Account'>My Account<\/a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href='store/logout.aspx' title='Sign Out'>Sign Out<\/a>";}
}
else
{
    if(page=='y')
        {          document.getElementById("fwsign").innerHTML=" <a href='loginform.aspx' title='My Account'>My Account<\/a>";
        }
    else
        {
         document.getElementById("fwsign").innerHTML=" <a href='store/loginform.aspx' title='My Account'>My Account<\/a>";
        }    
}
}
function verifysearchkeyword(st)
{
var keyword=document.getElementById('Keyword').value;
        if (keyword=="")
        {
        alert("Please enter keyword for search!");
        document.search.Keyword.focus();
        return false;
        }
        else
        {
        document.search.action=st+'search.aspx?q='+keyword;
        //document.search.submit();
        }
}
function GetXmlHttpObject7()
{
var xmlHttpobj7=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttpobj7=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttpobj7=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttpobj7=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttpobj7;
}
var xmlHttpobj7

function cart(opt)
{ 
xmlHttpobj7=GetXmlHttpObject7();
if (xmlHttpobj7==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var urll;  
 if (opt=='Y') 
  {	urll="store/cart.aspx";}
 else if(opt=='N')
  { urll="cart.aspx"; }	
urll=urll+"?cart="+get_cookie('shopbag');
urll=urll+"&DScart="+get_cookie('DScart');
urll=urll+"&indx="+opt ;
xmlHttpobj7.onreadystatechange=stateChangedfun7;
xmlHttpobj7.open("GET",urll,true);
xmlHttpobj7.send(null);
}
function stateChangedfun7() 
{ 
if (xmlHttpobj7.readyState==4)
	{window.parent.document.getElementById("minicart").innerHTML=xmlHttpobj7.responseText;}
}

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results )
    return ( unescape ( results[1] ) );
  else
    return null;
}

