﻿

/////////////////////////// START OF POP UP STUFF ////////////////////////////////////////////


/////////////////////////// END OF POP UP STUFF ////////////////////////////////////////////


function showAlertDetails(id1, id2, id3)	{
	obj = document.getElementById(id1).style.display = "none";

	obj = document.getElementById(id2).style.display;
	if (obj == "none")	{
		document.getElementById(id2).style.display = "";	
	}	else	{
		document.getElementById(id2).style.display = "none";	
	}		

	obj = document.getElementById(id3).value;
	if (obj == "")	{
		em0 = document.getElementById("email-o");
		if (em0 != null)	{
			em0 = document.getElementById("email-o").value;
			if (em0 != "")	{
				document.getElementById(id3).value = em0;
				return;
			}
		}
		em0 = document.getElementById("email-1");
		if (em0 != null)	{
			em0 = document.getElementById("email-1").value;
			if (em0 != "")	{
				document.getElementById(id3).value = em0;
				return;
			}
		}
		em0 = document.getElementById("email-2");
		if (em0 != null)	{
			em0 = document.getElementById("email-2").value;
			if (em0 != "")	{
				document.getElementById(id3).value = em0;
				return;
			}
		}
		em0 = document.getElementById("email-3");
		if (em0 != null)	{
			em0 = document.getElementById("email-3").value;
			if (em0 != "")	{
				document.getElementById(id3).value = em0;
				return;
			}
		}

	}
	
	DoFade(7, id2);
}

function searchPopProduct(search)	{
	document.getElementById("trackers").value = search;
	showTrackers(0,0,0);
}

function didYouMean(search)	{
	document.getElementById("trackers").value = search;
	showTrackers(0,0,0);
}

var sentID = null;

function changeLocale(type)		{
	var LO = document.getElementById("localeID").value;
	SetCookie("locale", LO, 999);
	if (type ==0)	window.location = "http://www.priceambush.com/index.php?locale="+LO;
		else window.location = "http://www.priceambush.com/index_bidders.php?locale="+LO;
}

function changeSearchIndex(sel)	{
	var LO = document.getElementById("localeID").value;
	document.getElementById("flag").innerHTML = "<img src='./images/"+LO+".gif' border='0'>";
	
	var htm = '<select id="searchIndexID" name="searchIndex" class="selectIndexStyle"><option value="Blended">All</option>';
	
	if (LO == "US" || LO == "UK" || LO =="DE" || LO =="JP")	htm = htm + '<option value="Apparel">Apparel</option>';
	if (LO == "US")	htm = htm + '<option value="Automotive">Automotive</option>';
	htm = htm + '<option value="Books">Books</option><option value="DVD">DVD</option>';
	if (LO != "CA")	htm = htm +'<option value="Electronics" selected="">Electronics</option>';
	if (LO == "US")	htm = htm + '<option value="Jewelry">Jewelry</option>';
	if (LO != "CA")	htm = htm +'<option value="Kitchen">Kitchen</option>'
	htm = htm + '<option value="Music">Music</option>';
	if (LO == "US" || LO == "DE")	htm=htm+'<option value="PCHardware">PC Hardware</option>';
	if (LO == "US" || LO == "DE")	htm=htm+'<option value="Photo">Photo</option>';	
	htm = htm + '<option value="Software">Software</option>';
	if (LO == "UK" || LO =="DE" || LO =="FR" || LO =="CA")	htm = htm + '<option value="SoftwareVideoGames">PC Games</option>';
	if (LO == "US" || LO =="UK" || LO =="DE" || LO =="JP")	htm = htm + '<option value="SportingGoods">Sporting Goods</option>';
	if (LO == "US" || LO =="UK" || LO =="DE" )	htm = htm + '<option value="Tools">Tools</option>';
	if (LO != "CA")	htm = htm +'<option value="Toys">Toys</option>';
	htm = htm + '<option value="VideoGames">Video Games</option>';
	if (LO == "UK" || LO =="DE" || LO =="FR" )	htm = htm + '<option value="Watches">Watches</option>';
	htm = htm + '</select>';
	
	document.getElementById("searchIndexOptions").innerHTML = htm;	
	var i=document.getElementById("searchIndexID").options.length-1;
	while (i>=0)	{
		if (document.getElementById("searchIndexID").options[i].text == sel)	{
			document.getElementById("searchIndexID").options.selectedIndex = i;
			break;
		}
		i = i -1;	
	}
	
}

function registerAlert(id)	{
	var ASIN 		= encodeURIComponent(document.getElementById("ASIN-"+id).value);
	var UPC 		= encodeURIComponent(document.getElementById("UPC-"+id).value);
	var ProductName = encodeURIComponent(document.getElementById("ProductName-"+id).value);
	var ProductSummary = encodeURIComponent(document.getElementById("ProductSummary-"+id).value);
	var email 		= encodeURIComponent(document.getElementById("email-"+id).value);
	var price 		= encodeURIComponent(document.getElementById("price-"+id).value);
	var currPrice 	= encodeURIComponent(document.getElementById("CurrPrice-"+id).value);
	var LO 			= document.getElementById("localeID").value;
			
	/*if (price>=currPrice)	{
		alert ("Sorry but you might as well purchase it right away - the price you indicated is higher than today's");
		return;
	}*/
	SetCookie("myEmail", email, 999);

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	 {
		 alert ("Browser does not support HTTP Request");
		 return;
	 } 
	var url = "registerAlert2.php?id="+id+"&UPC="+UPC+"&ASIN="+ASIN+"&ProductName="+ProductName+"&ProductSummary="+ProductSummary+"&email="+email+"&price="+price+"&locale="+LO;
	xmlHttp.onreadystatechange=registerCallBack;
	xmlHttp.open("GET",url,true);

	sentID = id;	   
    xmlHttp.send(null);	
	// send ajax request with these params!
	document.getElementById("addAlert-"+id).style.display = "none";
	document.getElementById("addAlertDetails-"+id).style.display = "none";
	
	document.getElementById("addAlertProgress-"+id).style.display = "";
}

function registerCallBack()	{
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")	 {
			if (xmlHttp.responseText!=null ) {
				document.getElementById("addAlertProgress-"+sentID ).style.display = "none";
				var id = xmlHttp.responseText;
				if (id.substring(0,2)=='-1')	{
					document.getElementById("addAlert-"+sentID).style.display = "";
					document.getElementById("addAlertDetails-"+sentID).style.display = "";
					alert (id.substring(2));						
				}	else	{
					document.getElementById("addAlertSuccess-"+sentID ).style.display = "";
					//alert ('Please confirm this tracker by following our instructions in your email');
				}
			}						
	} 
}


function togglewelcome()	{
	document.getElementById("welcomenoteid").style.display = "none";
	SetCookie("nowelcome", "1", 999);
}

function openToggle(signID, paneID)	{
	var pane = document.getElementById(paneID);
	var sign = document.getElementById(signID);

	sign.setAttribute('src','images/collapse.png');
	sign.setAttribute('title','Click to collapse this pane');
	pane.style.display = "";
	SetCookie(signID, "collapse", 999);
	SetCookie(paneID, "show", 999);
}

function closeToggle(signID, paneID)	{
	var pane = document.getElementById(paneID);
	var sign = document.getElementById(signID);

	sign.setAttribute('src','images/expand.png');
	sign.setAttribute('title','Click to expand this pane');
	pane.style.display = "none";
	SetCookie(signID, "expand", 999);
	SetCookie(paneID, "hide", 999);
}


function genericToggle(signID, paneID)	{
	var pane = document.getElementById(paneID);
	var sign = document.getElementById(signID);
	if (pane.style.display == "none")	{
		openToggle(signID, paneID)
	}		else	{
		closeToggle(signID, paneID)
	}
}


		function submitenterSearch(myfield,e,type) {
			var keycode;
			if (window.event) keycode = window.event.keyCode;
			else if (e) keycode = e.which;
			else return true;
			
			if (keycode == 13)	   {
			   	if	(document.getElementById("trackers").value == "e.g. 42\" LCD HDTV")
					document.getElementById("trackers").value = "42\" LCD HDTV";		
			   
			   if (type==0)				   showTrackers(0,0,0);
			   else	showBidders();
			   
			   if (document.getElementById)  objectItemold  = document.getElementById("searcherr");
					   else if (document.all)    objectItemold  = eval("searcherr"); 
			
				objectItemold.focus();   
			   return false;
			   }
			else
			   return true;
		}


	function navResults(newStart, search)	{
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		 {
			 alert ("Browser does not support HTTP Request");
			 return;
		 } 

  		 var locale = document.getElementById("localeID").value; 

		var url="searchProducts3.php";
		url=url+"?t="+encodeURIComponent(search)+"&s="+newStart + "&locale="+encodeURIComponent(locale);

   	   var objectItemold = document.getElementById("loader2");
	   objectItemold.style.display = "";

		var trak = document.getElementById("traky");
		trak.style.display = "none";	

	   xmlHttp.onreadystatechange=showTrackersStateChanged;
	   xmlHttp.open("GET",url,true);
	   
	   xmlHttp.send(null);	

	
	}
	
	function	showTrackersonLoad(by,index,q,asin,upc)	{
		//changeSearchIndex(index);
		if (q!="")		showTrackers(1,asin,upc);	

	}
	
	function enableSubmit()	{
		if	(document.getElementById("agree").checked=="checked")	{
				document.getElementById("sub").disabled="false";
		}

	}

	function showBidDetails(productID,locale)	{
		URL = "makeThemOffer.php?prdID="+productID+"&locale="+locale;
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=500');");
	}
	
	function showBidders()	{
	 if (document.getElementById)  objectItemold  = document.getElementById("trackers");
		   else if (document.all)    objectItemold  = eval("trackers"); 
	   if (!objectItemold) return;
	   var search = objectItemold.value;   
	   
	   var locale 		= document.getElementById("localeID").value; 
	   
	   if (search=="")	{
		    alert("C'mon... give me somthing real to search");
		   	return;
	   }
	   
	   	xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)	{
			 alert ("Browser does not support HTTP Request");
			 return;
		 } 

		var url="search_bidders.php";
		url=url+"?search="+encodeURIComponent(search) + "&locale="+encodeURIComponent(locale);

   	   var objectItemold = document.getElementById("loader2");
	   objectItemold.style.display = "";
	
	   xmlHttp.onreadystatechange=showBiddersStateChanged;
	   xmlHttp.open("GET",url,true);
	   	   
	   xmlHttp.send(null);	
	   document.getElementById("bidders_details").style.display = 'none';	   
	}


	function showBiddersStateChanged() 	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")	 {
			if (xmlHttp.responseText!=null ) {
				if (document.getElementById)  objectItemold  = document.getElementById("bidders_details");
				   else if (document.all)    objectItemold  = eval("bidders_details"); 
			    if (!objectItemold) return;
				
			    objectItemold.innerHTML = xmlHttp.responseText;
	    		document.getElementById("bidders_details").style.display = '';
	    		DoFade(7, "bidders_details");
			}

	   	   var objectItemold = document.getElementById("loader2");
		   objectItemold.style.display = "none";
		} 
	}
	




	function showTrackers(by,asin,upc){

	   if (document.getElementById)  objectItemold  = document.getElementById("trackers");
		   else if (document.all)    objectItemold  = eval("trackers"); 
		

	   if (!objectItemold) return;
	   var search = objectItemold.value;   

	   var locale 		= document.getElementById("localeID").value; 
	   var searchIndex  = document.getElementById("searchIndexID").value; 	   
	   
	   if (search=="")	{
		    alert("C'mon... give me somthing real to search");
		   	return;
	   }
	   
	   	xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)	{
			 alert ("Browser does not support HTTP Request");
			 return;
		 } 

		if (by ==0 && asin == '' && upc == '')	{
			var url="searchProducts3.php";
			url=url+"?t="+encodeURIComponent(search) + "&locale="+encodeURIComponent(locale) + "&searchIndex="+encodeURIComponent(searchIndex);
		}	else	{
			var url="searchProductsForAlert.php";
			url=url+"?t="+encodeURIComponent(search) + "&locale="+encodeURIComponent(locale) + "&searchIndex="+encodeURIComponent(searchIndex);
		
			if (by!=0)		url=url+"&by="+by;
			if (asin!=0)	url=url+"&asin="+asin;
			if (upc!=0)		url=url+"&upc="+upc;		
		}
   	   var objectItemold = document.getElementById("loader2");
	   objectItemold.style.display = "";
	
	   xmlHttp.onreadystatechange=showTrackersStateChanged;
	   xmlHttp.open("GET",url,true);
	   	   
	   xmlHttp.send(null);	
	   document.getElementById("traky").style.display = 'none';	   
	   //document.getElementById("googleAds").style.display = "none";
	   
	}



	function searchU(category, refine){
		if (document.getElementById)  objectItemold  = document.getElementById("trackers");
		   else if (document.all)    objectItemold  = eval("trackers"); 
	   var search = objectItemold.value;   
	   
	   	xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		 {
			 alert ("Browser does not support HTTP Request");
			 return;
		 } 

		var url="searchProducts.php";
		url=url+"?t="+encodeURIComponent(search)+"&c="+encodeURIComponent(category)+"&r="+encodeURIComponent(refine);

   	   var objectItemold = document.getElementById("loader2");
	   objectItemold.style.display = "";
	
	   xmlHttp.onreadystatechange=showTrackersStateChanged;
	   xmlHttp.open("GET",url,true);
	   
	   xmlHttp.send(null);	
	}


	
	function showTrackersStateChanged() 	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")	 {
			if (xmlHttp.responseText!=null ) {
				if (document.getElementById)  objectItemold  = document.getElementById("traky");
				   else if (document.all)    objectItemold  = eval("traky"); 
			    if (!objectItemold) return;
				
			    objectItemold.innerHTML = xmlHttp.responseText;
	    		document.getElementById("traky").style.display = '';
	    		DoFade(7, "traky");

			}

	   	   var objectItemold = document.getElementById("loader2");
		   objectItemold.style.display = "none";

/*		   var objectItemold = document.getElementById("headerstep1");
		   objectItemold.style.backgroundColor = "#ffffff";
		   var objectItemold = document.getElementById("headerstep2");
		   objectItemold.style.backgroundColor = "#FFFF77";*/

		} 
	}
	
	
	function checkdefaultsearch()	{
			if	(document.getElementById("trackers").value == "e.g. 42\" LCD HDTV")	{
					document.getElementById("trackers").value = "";		
					document.getElementById("trackers").style.color = "#000000";

			}
	}




function slctBtn(namey,left,onoff)	{
	elm = document.getElementById(namey);
	if (left==true && onoff==true)	elm.className = "button leftend selected";
	if (left==true && onoff==false)	elm.className = "button leftend";
	if (left==false && onoff==true)	elm.className = "button selected";
	if (left==false && onoff==false) elm.className = "button";		
}

function switchType(type, linkObj, compare)	{
	if (type == reportType && compare==false)	return;
	if (type == 'a')	{
		slctBtn('type1',true,true);
		slctBtn('type2',false,false);

		document.getElementById("comparestuff").style.display = "";

	}	else	if (type == 'd')	{
		slctBtn('type1',true,false);
		slctBtn('type2',false,true);

		document.getElementById("comparestuff").style.display = "none";
	}	else return;

	reportType=type;
	rerender();
}

function switchSmooth(smooth, linkObj)	{
	if (smooth == reportSmooth  )	return;
	switchSmoothEx(smooth, linkObj);
	rerender();
}
function switchSmoothEx(smooth, linkObj)	{
	if (smooth == reportSmooth)	return;
	userTouchedSmooth = 1;
	if (smooth == 'd')	{
		slctBtn('smooth1',true,true);
		slctBtn('smooth2',false,false);
		slctBtn('smooth3',false,false);
	}	else	if (smooth == 'w')	{
		slctBtn('smooth1',true,false);
		slctBtn('smooth2',false,true);
		slctBtn('smooth3',false,false);
	}	else	if (smooth == 'm')	{
		slctBtn('smooth1',true,false);
		slctBtn('smooth2',false,false);
		slctBtn('smooth3',false,true);
	}	else return;
	
	reportSmooth  = smooth;
}

function switchRange(range, linkObj)	{
	if (range == reportRange)	return;

	if (range== '7d')	{
		if (userTouchedSmooth==0)	switchSmoothEx('d', null);
		slctBtn('range1',true,true);
		slctBtn('range2',false,false);
		slctBtn('range3',false,false);
		slctBtn('range4',false,false);
		slctBtn('range5',false,false);
		slctBtn('range6',false,false);
	}	else	if (range== '14d')	{
		if (userTouchedSmooth==0)	switchSmoothEx('d', null);
		slctBtn('range1',true,false);
		slctBtn('range2',false,true);
		slctBtn('range3',false,false);
		slctBtn('range4',false,false);
		slctBtn('range5',false,false);
		slctBtn('range6',false,false);
	}	else	if (range== '1m')	{
		if (userTouchedSmooth==0)	switchSmoothEx('d', null);
		slctBtn('range1',true,false);
		slctBtn('range2',false,false);
		slctBtn('range3',false,true);
		slctBtn('range4',false,false);
		slctBtn('range5',false,false);
		slctBtn('range6',false,false);
	}	else	if (range== '3m')	{
		if (userTouchedSmooth==0)	switchSmoothEx('w', null);
		slctBtn('range1',true,false);
		slctBtn('range2',false,false);
		slctBtn('range3',false,false);
		slctBtn('range4',false,true);
		slctBtn('range5',false,false);
		slctBtn('range6',false,false);
	}	else	if (range== '6m')	{
		if (userTouchedSmooth==0)	switchSmoothEx('w', null);
		slctBtn('range1',true,false);
		slctBtn('range2',false,false);
		slctBtn('range3',false,false);
		slctBtn('range4',false,false);
		slctBtn('range5',false,true);
		slctBtn('range6',false,false);
	
	}	else	if (range== '1y')	{
		if (userTouchedSmooth==0)	switchSmoothEx('m', null);
		slctBtn('range1',true,false);
		slctBtn('range2',false,false);
		slctBtn('range3',false,false);
		slctBtn('range4',false,false);
		slctBtn('range5',false,false);
		slctBtn('range6',false,true);
		
	}	else return;
	
	reportRange  = range;
	rerender();
}


function rerender()	{
	var s1 = (document.getElementById("s1"));
	var n1 = s1.options[s1.selectedIndex].text;
	var QS1 = (s1.value);

	if (reportType == 'a')	{
		var s2 = (document.getElementById("s2"));
		var s3 = (document.getElementById("s3"));
	
		var QS2 = ""; var n2 ="";
		var QS3 = ""; var n3 = "";
		
		if (s2)	{
			QS2 = (s2.value);
			var n2 = s2.options[s2.selectedIndex].text;	
		}
		
		if (s3) {
			QS3 = (s3.value);
			var n3 = s3.options[s3.selectedIndex].text;			
		}
		
		if (n1 != "")	QS1 = "n1="+ n1 + "&" + s1.value;	
		if (n2 != "")	QS2 = "n2="+ n2 + "&" + QS2;	
		if (n3 != "")	QS3 = "n3="+ n3 + "&" + QS3;	
	
		if	(QS1 == "" && QS2 == "" && QS3 == "")	return;
		if	(QS1 == "" && QS2 != "")				{	QS1 = QS2;	QS2= "";	}
		if	(QS1 == "" && QS3 != "")				{	QS1 = QS3;	QS3= "";	}
		if	(QS2 == "" && QS3 != "")				{	QS2 = QS3; 	QS3= "";	}
	}
	
	var titletext = "Price Tracker for "+n1;
	document.getElementById("trendtitle").innerHTML = titletext;	
	
	var uid = Math.round(Math.random() * 10000);
	var querystr = escape("trendchart.php?"+QS1+"&"+QS2+"&"+QS3+"&type="+reportType+"&range="+reportRange+ "&smooth="+reportSmooth +"&u="+uid);

	var flashobj = "<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH=640 HEIGHT=260 id='charts' ALIGN=''>";
	var param1 = "<PARAM NAME=movie VALUE='charts.swf?library_path=charts_library&php_source="+querystr+"'>";
	var param2 = "<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#ffffff><PARAM NAME=wmode VALUE=transparent>";
	var emd = "<EMBED src='charts.swf?library_path=charts_library&php_source="+querystr+"' quality=high bgcolor=#ffffff WIDTH=640 HEIGHT=260 NAME='charts' ALIGN='' swLiveConnect='true' wmode=transparent TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>\n";
	var ht = flashobj+param1+param2+emd;	
	document.getElementById("thechart").innerHTML = ht;			

	var hre = "http://www.pricefad.com/chart.php?range=" + reportRange + "&type=" + reportType + "&smooth=" + reportSmooth + "&n=" + reportSearchname +"&u=" +reportSearchusername;

	if (n2 != "" && n3 != "")	hre = hre + "&" + QS2  + "&" + QS3;
	if (n2 != "" && n3 == "")	hre = hre + "&" + QS2;
	if (n2 == "" && n3 != "")	hre = hre + "&" + QS3;
	
	document.getElementById("permalink").href = hre;
	document.getElementById("deals").innerHTML = "<p></p>";
	//document.getElementById("dealstitle").innerHTML = "<h2>  Opportunities Details [click on chart dates to see] </h2>"; 
}

function compare()	{
	switchType('a', null, true);
}

	
function GetXmlHttpObject()		{
	var xmlHttp=null;
	try		 {
		 // Firefox, Opera 8.0+, Safari
		 xmlHttp=new XMLHttpRequest();
	 }	catch (e)			 {
		 //Internet Explorer
		 try	 {	
			  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		 }	 catch (e)	 {
			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		 }
	 }
	return xmlHttp;
}


var FadeInterval = 600;
var StartFadeAt = 7;
var FadeSteps = new Array();
	FadeSteps[1] = "ff";
	FadeSteps[2] = "ee";
	FadeSteps[3] = "dd";
	FadeSteps[4] = "cc";
	FadeSteps[5] = "bb";
	FadeSteps[6] = "aa";
	FadeSteps[7] = "99";
	FadeSteps[8] = "88";
	FadeSteps[9] = "77";
	FadeSteps[10] = "66";
	FadeSteps[11] = "55";
	FadeSteps[12] = "44";
	FadeSteps[13] = "33";
	FadeSteps[14] = "22";

function DoFade(colorId, targetId) {
    if (colorId >= 1) {
		document.getElementById(targetId).style.backgroundColor = "#ffff" + FadeSteps[colorId];
        if (colorId==1) {
            document.getElementById(targetId).style.backgroundColor = "transparent";
		}
        colorId--;
        setTimeout("DoFade("+colorId+",'"+targetId+"')", FadeInterval);
	}
}

function subscribeEmail()	{
  		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)		 {
			 alert ("Browser does not support HTTP Request");
			 return;
		} 		
   	    var objectItemold = document.getElementById("loader4");
	    objectItemold.style.display = "";

		var email = (document.getElementById("emailaddr").value);
		SetCookie("myEmail", email, 999);
		var pricedrop = -1;
		if (!document.getElementById("pricedropcheck").checked=="")	pricedrop = encodeURIComponent(document.getElementById("pricedrop").value);
				
		var searname 	 = reportSearchname ;
		var searusername = reportSearchusername ;

		
		var url="emailRegister.php?s="+searname +"&u="+searusername +"&email=" +email;
		if (pricedrop != -1)	url = url + "&drop=" + pricedrop;
		   	  

		xmlHttp.onreadystatechange=emailRegFinish;
		xmlHttp.open("GET",url,true);

		xmlHttp.send(null);	
   	    
}

function emailRegFinish() 	{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")	 {
			if (xmlHttp.responseText!=null ) {
				DoFade(7, "registration");

   	   			var objectItemold = document.getElementById("loader4");
	   			objectItemold.style.display = "none";

				alert (xmlHttp.responseText);
								
				var objectItemold = document.getElementById("registration");
				objectItemold.style.display = "none";
				
			}
	 } 
}


function SetCookie(cookieName,cookieValue,nDays) {
	 var today = new Date();
	 var expire = new Date();
	 if (nDays==null || nDays==0) nDays=1;
	 expire.setTime(today.getTime() + 3600000*24*nDays);
	 document.cookie = cookieName+"="+(escape(cookieValue)) + ";expires="+expire.toGMTString();
}

function ReadCookie(cookieName) {
	 var theCookie=""+document.cookie;
	 var ind=theCookie.indexOf(cookieName);
	 if (ind==-1 || cookieName=="") return ""; 
	 var ind1=theCookie.indexOf(';',ind);
	 if (ind1==-1) ind1=theCookie.length; 
	 return (unescape(theCookie.substring(ind+cookieName.length+1,ind1)));
}

function showEmailReg()	{
	DoFade(5, "registration");
	
	var objectItemold = document.getElementById("registration");
	if (objectItemold.style.display == "none")	{
		objectItemold.style.display = "";
		document.getElementById("emailaddr").value = ReadCookie("myEmail");
	}
		else	objectItemold.style.display = "none";
}




	
