// JavaScript Document

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function imagespreload(){

MM_preloadImages('images/topbg.jpg','images/line1.png','images/bg1.jpg','images/line2.png','images/line3.png','images/freedelivery.png','images/movie1.jpg','images/movie2.jpg','images/movie3.jpg','images/moviebg.jpg','images/1.jpg','images/1on.jpg','images/number1.png','images/loading1.gif','images/loading2.gif','images/number2.png','images/number3.png','images/number5.png','images/number5.png','images/number6.png','images/number7.png','images/number8.png','images/2.jpg','images/2on.jpg','images/number83.png','images/leftbg1.jpg','images/leftbg2.jpg','images/searchbar_22.jpg','images/searchbar_24.jpg','images/searchbar_26','images/searchbar2_22.jpg','images/searchbar2_24.jpg','images/searchbar2_26','images/leftbg3.jpg','images/leftbg4.jpg','images/leftbg5.jpg','images/leftbg6.jpg','images/games.jpg','images/submit.jpg','images/cart.jpg','images/bb1.jpg','images/bb2.jpg','images/hotbg.jpg','images/point.png','images/pp.jpg','images/add.jpg','images/pre.jpg','images/back.jpg','images/more.jpg','images/mbg.jpg','images/all.jpg','images/all2.jpg','images/starrating.gif.jpg','images/leftbg7.jpg','images/soon.jpg','images/working.gif','images/big_bestseller.gif','images/big_new.gif','images/spinner.gif','images/rate1.gif','images/rate2.gif','images/rate3.gif','images/rate4.gif','images/rate5.gif','images/check.jpg','images/delete.jpg','images/free.jpg','images/multiple.jpg','images/save.jpg','images/shopping.jpg','images/wrap.jpg','images/mailingload.gif','images/mailing.jpg')

}


function cologout()
{
var lg = confirm("You want to logout !! \n So be careful that all the unsaved items \n in your cart will be deleted \n Do you want to continue ?") 
return lg;

if(lg)
{

location.href = "logout.aspx";
}
else 
{

location.href = "cart.aspx";
}

}



	
	


			function hidecontactresult(){
			document.getElementById("mailingresult").innerHTML="";
			}
	

			function sendcontact() { 
			   var validate= true;
			   var fname=document.mailing.fname.value; var birth=document.mailing.birth.value;
				var email=document.mailing.email.value; 
				
				for (var i=0; i < document.mailing.genre.length; i++)
   {
   if (document.mailing.genre[i].checked)
      {
      var genre = document.mailing.genre[i].value;
      }
   }
   
   for (var i=0; i < document.mailing.status.length; i++)
   {
   if (document.mailing.status[i].checked)
      {
      var status = document.mailing.status[i].value;
      }
   }
   
   for (var i=0; i < document.mailing.child.length; i++)
   {
   if (document.mailing.child[i].checked)
      {
      var child = document.mailing.child[i].value;
      }
   }

				
				 
			
				
				 if(email== ""){ alert("enter an email!");
				document.mailing.email.focus(); validate=false;  }
				else if(validateEmailv2(email)== false){ alert("enter a valid email!");
				document.mailing.email.focus(); validate=false;  }
			
				
				else if(fname==""){ alert("enter your full name!");
				document.mailing.fname.focus(); validate=false; }
				
				else if(birth== ""){ alert("enter your birth date!");
				document.mailing.birth.focus(); validate=false; }
				
				
				if(validate==true){
				
				
				
					var xmlHTTP;

	try
	{
		xmlHTTP = new XMLHttpRequest();
	}
	catch(err)
	{
		try
		{
			xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(err)
		{
			try
			{
				xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(err)
			{
				return false;
			}
		}
	}
		
var url = "sendmailing.aspx";
var params = "fname="+fname+"&email="+email+"&genre="+genre+"&status="+status+"&child="+child+"&birth="+birth;
xmlHTTP.open("POST", url, true);

//Send the proper header information along with the request
xmlHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHTTP.setRequestHeader("Content-length", params.length);
xmlHTTP.setRequestHeader("Connection", "close");

xmlHTTP.onreadystatechange = function()
	{
		if(xmlHTTP.readyState == 4)
		{
			var resp;
			//var aResponse = new Array();
			//var buffer;
			resp = xmlHTTP.responseText;
			document.getElementById("mailingresult").innerHTML = resp;

		}
		if(xmlHTTP.readyState == 1)
		{
		document.getElementById("mailingresult").innerHTML ="<br><div align=center><img src=\"images/mailingload.gif\"></div>";
					document.mailing.email.value=""; document.mailing.fname.value="";   document.mailing.birth.value=""; 
			document.mailing.status[0].checked=true; document.mailing.genre[0].checked=true; document.mailing.child[0].checked=true;
		}
	}

xmlHTTP.send(params);
				
				
				}
				

setTimeout("hidecontactresult()",5000);
		
				
			}
			
			
	
	// search area
	
	
	var subject_id = '';
	function handleHttpResponse() {
		if (http.readyState == 4) {
			if (subject_id != '') {
				document.getElementById(subject_id).innerHTML = http.responseText;
			}
		}
	}
	function getHTTPObject() {
		var xmlhttp;
		/*@cc_on
		@if (@_jscript_version >= 5)
			try {
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (E) {
					xmlhttp = false;
				}
			}
		@else
		xmlhttp = false;
		@end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp = false;
			}
		}
		return xmlhttp;
	}
	var http = getHTTPObject(); // We create the HTTP Object

	function getScriptPage(div_id,content_id)
	{
		subject_id = div_id;
		var categ=document.searchform.searchlist.value;
		content = document.getElementById(content_id).value;
		http.open("GET", "script_page.php?content=" + escape(content)+"&cat="+categ, true);
		http.onreadystatechange = handleHttpResponse;
		http.send(null);
		if(content.length>0)
			box('1');
		else
			box('0');

	}	

	function highlight(action,id)
	{
	  if(action)	
		document.getElementById('word'+id).bgColor = "#c6282c";
	  else
		document.getElementById('word'+id).bgColor = "#F8F8F8";
	}
	function got(pro)
	{ 
	 var proti=document.getElementById('prodiv'+pro).value;
	 var proar=document.getElementById('artdiv'+pro).value;
	    document.getElementById('searchbox').value=proti;
		document.getElementById('prosearch').value=proti;
		document.getElementById('artsearch').value=proar;
	   document.getElementById('box').style.display = 'none';
	   document.getElementById('searchlist2').value= document.getElementById('searchlist').value;
		document.searchform2.submit();
		//document.getElementById('text_content').focus();
	}
	
	function hideall()
	{ 
	
		document.getElementById('searchbox').value='';
		document.getElementById('box').style.display = 'none';
		
	}
	function box(act)
	{
	  if(act=='0')	
	  {
		document.getElementById('box').style.display = 'none';

	  }
	  else {
		document.getElementById('box').style.display = 'block';
	  }
	}
			
			
	function validationbar(){
			validate= true;
				   var cat=document.searchform.searchlist.value; 
				  
				   if(cat== ""){ alert("choose a type!");
				document.searchform.searchlist.focus(); validate=false; }
				
				   
				}		