	var httpsendobject
	var name
	var email_id
	var recipient_list
	var receiveurl

	function init()
	{
		httpsendobject=getXMLobject()
	} // end function init

	function getXMLobject()
	{
			//code for Mozilla
			if (window.XMLHttpRequest)
					xmlobject=new XMLHttpRequest()
			//code for IE
			else if (window.ActiveXObject)
					xmlobject=new ActiveXObject("Microsoft.XMLHTTP")
			if (xmlobject){
					 return xmlobject}
			else window.alert("Could not create xmlhttp object")
	} // end function getXMLobject

	function checkmail(Email)
	{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(Email.value ))
		{
			return 0; // valid
		}
		else
		{
			return 1; // Invalid
		}
	} // end function checkmail

	function Trim(TRIM_VALUE)
	{
		if(TRIM_VALUE.length < 1)
		{ 
			return "";
		}
		TRIM_VALUE = RTrim(TRIM_VALUE);
		TRIM_VALUE = LTrim(TRIM_VALUE);
		if(TRIM_VALUE=="")
		{
			return ""; 
		}
		else
		{
			return TRIM_VALUE;
		}
	} // end function Trim

	function RTrim(VALUE)
	{
		var w_space = String.fromCharCode(32);
		var v_length = VALUE.length;
		var strTemp = "";
		if(v_length < 0)
		{
			return "";
		}
		var iTemp = v_length -1;
	
		while(iTemp > -1) 
		{
			if(VALUE.charAt(iTemp) == w_space){
		}
		else
		{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1; 
		
		} //End While
		return strTemp;
	
	} // end function RTrim
	
	function LTrim(VALUE)
	{
	var w_space = String.fromCharCode(32);
	if(v_length < 1)
	{ 
		return "";
	}
	var v_length = VALUE.length;
	var strTemp = "";
	
	var iTemp = 0;
	
	while(iTemp < v_length)
	{
		if(VALUE.charAt(iTemp) == w_space) 
		{
		}
		else
		{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
		} //End While
		return strTemp; 
	} // end function LTrim

	function subscribe_guide()
	{
		var form = document.subscribe
		document.getElementById("subscribe_response").innerHTML = "<font style='background-color:#0000FF' color='#FFFFFF'>Subscribing...</font>"

		subscribe_email = form.subscribe_email.value

		if( subscribe_email == "" || Trim(subscribe_email) == "" || subscribe_email == "Enter your Email")
		{
			// Invalid Form. Report Error
			document.getElementById("subscribe_response").innerHTML = "<font style='background-color:#AE0000' color='#FFFFFF'>Enter your Email!</font>";
			return false;
		} // end if
		else
		{

			 if( checkmail(form.subscribe_email)=='1' )
			 {
				document.getElementById("subscribe_response").innerHTML = "<font style='background-color:#AE0000' color='#FFFFFF'>Invalid Email!</font>";
				return false;
			 } // end if

			 mesgurl = "subscribe_email="+encodeURI(subscribe_email)
			 receiveurl = "/weekend_subscribe.php"

			httpsendobject.open('POST', receiveurl, true);
			httpsendobject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			httpsendobject.setRequestHeader("Content-length", mesgurl.length);
			httpsendobject.setRequestHeader("Connection", "close");
			httpsendobject.send(mesgurl);
			httpsendobject.onreadystatechange = processSubscribe

		} // end else

		return false;
	}

	function weekend_guide_share()
	{
		var form = document.weekend_guide
		document.getElementById("response").innerHTML = "<font style='background-color:#0000FF' color='#FFFFFF'>Sharing...</font>"

		name = form.name.value
		email_id = form.email_id.value
		recipient_list = form.recipient_list.value
		date = form.date.value
		week = form.week.value

		if( name == "" || Trim(name) == "" || email_id == "" || Trim(email_id) == "" )
		{
			// Invalid Form. Report Error
			document.getElementById("response").innerHTML = "<font style='background-color:#AE0000' color='#FFFFFF'>Please fill all fields!</font>";
			return false;		
		} // end if
		else
		{

			 if( checkmail(form.email_id)=='1' )
			 {
				document.getElementById("response").innerHTML = "<font style='background-color:#AE0000' color='#FFFFFF'>Invalid Email!</font>";
				return false;
			 }

			mesgurl = "date="+encodeURI(date)+"&week="+encodeURI(week)+"&name="+encodeURI(name)+"&email_id="+encodeURI(email_id)+"&recipient_list="+encodeURI(recipient_list)
			receiveurl = "/weekend_share.php"

			httpsendobject.open('POST', receiveurl, true);
			httpsendobject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			httpsendobject.setRequestHeader("Content-length", mesgurl.length);
			httpsendobject.setRequestHeader("Connection", "close");
			httpsendobject.send(mesgurl);
			httpsendobject.onreadystatechange = processPage
			
			return false;
		} // end else
	} // end function weekend_guide_share

	function processSubscribe()
	{
		if (httpsendobject.readyState==4)
		{
			if (httpsendobject.status==200)
			{
				document.getElementById("subscribe_response").innerHTML = "<font style='background-color:#0000FF' color='#FFFFFF'>"+httpsendobject.responseText+"</font>";
			} // end if
			else 
			{
				document.getElementById("subscribe_response").innerHTML = "<font style='background-color:#AE0000' color='#FFFFFF'>"+httpsendobject.statusText+"! Please try later.</font>";
			} // end else
		} // end if
		else{}
	} // end function processPage

	function processPage()
	{
		if (httpsendobject.readyState==4)
		{
			if (httpsendobject.status==200)
			{
				document.getElementById("response").innerHTML = "<font style='background-color:#0000FF' color='#FFFFFF'>"+httpsendobject.responseText+"</font>";
			} // end if
			else 
			{
				document.getElementById("response").innerHTML = "<font style='background-color:#AE0000' color='#FFFFFF'>"+httpsendobject.statusText+"! Please try later.</font>";
			} // end else
		} // end if
		else{}
	} // end function processPage

	function changePreview(itemNumber) {
		document.getElementById('infotable1').style.display = 'none';
		document.getElementById('infotable2').style.display = 'none';
		document.getElementById('infotable3').style.display = 'none';
		document.getElementById('infotable4').style.display = 'none';
		document.getElementById('infotable5').style.display = 'none';
		document.getElementById('infotable7').style.display = 'none';
		document.getElementById('infotable' + itemNumber).style.display = '';
		tds = document.getElementById('infotable').getElementsByTagName('TD');

		for(i=0;i<tds.length;i++) {
			if(tds[i].className == 'active menu') tds[i].className = 'menu';
		} // end for
	} // end function changePreview
