// JavaScript Document
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtPOPUP").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtPOPUP").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","IDPage.php?Did="+str,true);
xmlhttp.send();
}

function WHshowUser(SUWHstr)
{
if (SUWHstr=="")
  {
  document.getElementById("txtPOPUP").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtPOPUP").innerHTML = xmlhttp.responseText;
	document.getElementById('fade2').style.display='block';
    }
  }
xmlhttp.open("GET","IDPage.php?Did="+SUWHstr,true);
xmlhttp.send();
}

function showCS(SUCSstr)
{
if (SUCSstr=="")
  {
  document.getElementById("HOMEBACK").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("HOMEBACK").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","CS/CS.html",true);
xmlhttp.send();
}

function showWHP(WHPstr)
{
if (WHPstr=="")
  {
  document.getElementById("HOMEBACK").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("HOMEBACK").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ICatsWH.php",true);
xmlhttp.send();
}

function showKeyMembers(SUKMstr)
{
if (SUKMstr=="")
  {
  document.getElementById("txtPOPUP").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtPOPUP").innerHTML = xmlhttp.responseText;
	document.getElementById('fade2').style.display='block';
    }
  }
xmlhttp.open("GET","KeyMembers/login.php",true);
xmlhttp.send();
}

function showWhoAreWe(WAWstr)
{
if (WAWstr=="")
  {
  document.getElementById("HOMEBACK").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("HOMEBACK").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","WhoAreWe/AboutUs.html",true);
xmlhttp.send();
}

function parseScript()
{
		var source = xmlhttp.responseText;
		var scripts = new Array();
 
		// Strip out tags
		while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) {
			var s = source.indexOf("<script");
			var s_e = source.indexOf(">", s);
			var e = source.indexOf("</script", s);
			var e_e = source.indexOf(">", e);
 
			// Add to scripts array
			scripts.push(source.substring(s_e+1, e));
			// Strip from source
			source = source.substring(0, s) + source.substring(e_e+1);
		}
 
		// Loop through every script collected and eval it
		for(var i=0; i<scripts.length; i++) {
			try {
				eval(scripts[i]);
			}
			catch(ex) {
				// do what you want here when a script fails
			}
		}
		// Return the cleaned source
		return source;
}

function clearDiv(CDiv)
{
if (CDiv=="")
  {
  document.getElementById("txtPOPUP").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtPOPUP").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","Blank.php?B="+CDiv,true);
xmlhttp.send();
}


function showYouTube(sYT)
{
if (sYT=="")
  {
  document.getElementById("txtYouTube").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtYouTube").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","YouTube.php?Did="+sYT,true);
xmlhttp.send();
}

function clearCsYT(CsYT)
{
if (CsYT=="")
  {
  document.getElementById("txtYouTube").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtYouTube").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","Blank.php?B="+CsYT,true);
xmlhttp.send();
}

function DisplayCat(PCid,HTPass)
{
if (PCid=="")
  {
  document.getElementById("HOMEBACK").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("HOMEBACK").innerHTML = xmlhttp.responseText;
	document.location.hash = HTPass
    }
  }
xmlhttp.open("GET","ICats.php?id="+PCid,true);
xmlhttp.send();
}

function DisplayCatAll(PCAid)
{
if (PCAid=="")
  {
  document.getElementById("HOMEBACK").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("HOMEBACK").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ICatsAll.php?id="+PCAid,true);
xmlhttp.send();
}

function DisplaySearchCat(PSCid)
{
xmlhttp.responseText=="";
if (PSCid=="")
  {
  document.getElementById("HOMEBACK").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
	document.getElementById("HOMEBACK").innerHTML = xmlhttp.responseText;
	_gaq.push(['_trackEvent', 'Search', 'Searched For '+PSCid, PSCid+' Search'])
    }
  }
xmlhttp.open("GET","ICatsSearch.php?QrySearch="+PSCid,true);
xmlhttp.send();
}

function DisplayWH(WHid)
{
if (WHid=="")
  {
  document.getElementById("HOMEBACK").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("HOMEBACK").innerHTML = xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","WhatsHot.php",true);
xmlhttp.send();
}

function parseWHScript()
{
		var source = xmlhttp.responseText;
		var scripts = new Array();
 
		// Strip out tags
		while(source.indexOf("<script") > -1 || source.indexOf("</script") > -1) {
			var s = source.indexOf("<script");
			var s_e = source.indexOf(">", s);
			var e = source.indexOf("</script", s);
			var e_e = source.indexOf(">", e);
 
			// Add to scripts array
			scripts.push(source.substring(s_e+1, e));
			// Strip from source
			source = source.substring(0, s) + source.substring(e_e+1);
		}
 
		// Loop through every script collected and eval it
		for(var i=0; i<scripts.length; i++) {
			try {
				eval(scripts[i]);
			}
			catch(ex) {
				// do what you want here when a script fails
			}
		}
		// Return the cleaned source
		return source;
}

function pausecomp(millis) {
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); }
    while(curDate-date < millis);
  }



document.onkeypress = keyPress;
var count = 1;

function keyPress() {
if (window.event.keyCode == 13)
{
	if (AjaxSearch.elements['ProductSearch'].value=="")
	{
		event.returnValue=false;
    	event.cancel = true;
	}
	else
	{
		event.returnValue=false;
    	event.cancel = true;
		DisplaySearchCat(AjaxSearch.elements['ProductSearch'].value);
	}
}
}


function showSearchstrResult(Searchstr)
{if (window.event.keyCode == 13)
 {
		event.returnValue=false;
    	event.cancel = true;
 }
else
	{
		if (Searchstr.length==0)
  { 
  document.getElementById("livesearch").innerHTML="";
  document.getElementById("livesearch").style.border="0px";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("livesearch").innerHTML=xmlhttp.responseText;
    document.getElementById("livesearch").style.border="1px solid #A5ACB2";
    }
  }
xmlhttp.open("GET","ICSearchText.php?QrySearch="+Searchstr,true);
xmlhttp.send();
}
}


function LoadFBItem(RfId)
{
	pausecomp(5000);
	DisplayCat(RfId);
}

function LoadFBDItem(ReD2id)
{
	pausecomp(9000);
	showUser(ReD2id);
}
