//Show Discount Coupon Pop Up 
	function showDivFacilityCoupon(sp) 
	{ 	
		var ajaxRequest;  // The variable that makes Ajax possible!
	    try
		{
      		// Opera 8.0+, Firefox, Safari
      		ajaxRequest = new XMLHttpRequest();
     	} 
	 	catch (e)
	 	{
      		// Internet Explorer Browsers
      		try
	  		{
       			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
      		}
	  		catch (e) 
	  		{
       			try
	   			{
        			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
       			} 
	   			catch (e)
	   			{
        			// Something went wrong
        			alert("Your browser broke!"); 
			    }
      		}
     	}
     	// Create a function that will receive data sent from the server
     	ajaxRequest.onreadystatechange = function()
		{
			if(ajaxRequest.readyState == 4)
			{
				if (ajaxRequest.status == 200)
				{
					var resp=ajaxRequest.responseText;
					document.getElementById("ajaxCoupon").innerHTML=resp;        
				}
			}
		 }
		 url="get-discount-coupon.php?sp="+sp;
		 ajaxRequest.open("GET", url, true);
		 ajaxRequest.send(null);  
		 if (document.getElementById) 
		 { // DOM3 = IE5, NS6 
			document.getElementById('hideshowCoupon').style.visibility = 'visible'; 
		 } 
		else 
		{ 
			if (document.layers) 
			{ // Netscape 4 
				document.hideshowCoupon.visibility = 'visible'; 
			} 
			else 
			{ // IE 4 
				document.all.hideshowCoupon.style.visibility = 'visible'; 
			} 
		} 
	}
	//Hide Discount Coupon Pop Up 
	function hideDivFacilityCoupon() 
	{ 
		if (document.getElementById) 
		{ // DOM3 = IE5, NS6 
			document.getElementById('hideshowCoupon').style.visibility = 'hidden'; 
		} 
		else 
		{ 
			if (document.layers) 
			{ // Netscape 4 
				document.hideshowCoupon.visibility = 'hidden'; 
			} 
			else 
			{ // IE 4 
				document.all.hideshowCoupon.style.visibility = 'hidden'; 
			} 
		} 
	}
//Show Discount Coupon Pop Up 
	function showDivPrintCoupon(name,email,mobile,sp) 
	{ 	
		var ajaxRequest;  // The variable that makes Ajax possible!
	    try
		{
      		// Opera 8.0+, Firefox, Safari
      		ajaxRequest = new XMLHttpRequest();
     	} 
	 	catch (e)
	 	{
      		// Internet Explorer Browsers
      		try
	  		{
       			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
      		}
	  		catch (e) 
	  		{
       			try
	   			{
        			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
       			} 
	   			catch (e)
	   			{
        			// Something went wrong
        			alert("Your browser broke!"); 
			    }
      		}
     	}
     	// Create a function that will receive data sent from the server
     	ajaxRequest.onreadystatechange = function()
		{
			if(ajaxRequest.readyState == 4)
			{
				if (ajaxRequest.status == 200)
				{
					var resp=ajaxRequest.responseText;
					document.getElementById("ajaxPrintCoupon").innerHTML=resp;        
				}
			}
		 }
		 url="print-discount-coupon.php?name="+name+"&email="+email+"&mobile="+mobile+"&sp="+sp;
		 ajaxRequest.open("GET", url, true);
		 ajaxRequest.send(null);  
		 if (document.getElementById) 
		 { // DOM3 = IE5, NS6 
			document.getElementById('hideshowPrintCoupon').style.visibility = 'visible'; 
		 } 
		else 
		{ 
			if (document.layers) 
			{ // Netscape 4 
				document.hideshowPrintCoupon.visibility = 'visible'; 
			} 
			else 
			{ // IE 4 
				document.all.hideshowPrintCoupon.style.visibility = 'visible'; 
			} 
		} 
	}
	//Hide Discount Coupon Pop Up 
	function hideDivPrintCoupon() 
	{ 
		if (document.getElementById) 
		{ // DOM3 = IE5, NS6 
			document.getElementById('hideshowPrintCoupon').style.visibility = 'hidden'; 
		} 
		else 
		{ 
			if (document.layers) 
			{ // Netscape 4 
				document.hideshowPrintCoupon.visibility = 'hidden'; 
			} 
			else 
			{ // IE 4 
				document.all.hideshowPrintCoupon.style.visibility = 'hidden'; 
			} 
		} 
	}
	/*function to print the coupon*/
	function printContent(id)
	{
		str=document.getElementById(id).innerHTML
		newwin=window.open('','printwin','left=100,top=100,width=400,height=400')
		newwin.document.write('<HTML>\n<HEAD>\n')
		newwin.document.write('<style type="text/css">')
		newwin.document.write('body{background:#FFFFFF !important;}')
		newwin.document.write('</style>')	
		newwin.document.write('<link href="css/style.css" rel="stylesheet" type="text/css" media="print"/>\n')
		newwin.document.write('<link href="css/style.css" rel="stylesheet" type="text/css" media="screen"/>\n')
		newwin.document.write('<TITLE>Print Page</TITLE>\n')
		newwin.document.write('<script>\n')
		newwin.document.write('function chkstate(){\n')
		newwin.document.write('if(document.readyState=="complete"){\n')
		newwin.document.write('window.close()\n')
		newwin.document.write('}\n')
		newwin.document.write('else{\n')
		newwin.document.write('setTimeout("chkstate()",2000)\n')
		newwin.document.write('}\n')
		newwin.document.write('}\n')
		newwin.document.write('function print_win(){\n')
		newwin.document.write('window.print();\n')
		newwin.document.write('chkstate();\n')
		newwin.document.write('}\n')
		newwin.document.write('<\/script>\n')
		newwin.document.write('</HEAD>\n')
		newwin.document.write('<BODY onload="print_win()">\n')
		newwin.document.write(str)
		newwin.document.write('</BODY>\n')
		newwin.document.write('</HTML>\n')
		newwin.document.close()
	}
	function validateCouponUser(sp)
	{
		var frm = document.newexplore;
		if(frm.txtname.value=='')
		{
			alert("Please enter Name.");
			frm.txtname.select();
			return false;
		}
		if(frm.txtusername.value=='')
		{
			alert("Please enter Email ID.");
			frm.txtusername.select();
			return false;
		}
		if(!isEmail(frm.txtusername.value))
		{
			alert('Please enter valid Email ID.');
			frm.txtusername.value='';
			frm.txtusername.focus();
			return false;
		}
		if(frm.txtmobile.value=='')
		{
			alert("Please enter Mobile Number.");
			frm.txtmobile.select();
			return false;
		}
		if(!isMobileno(frm.txtmobile.value))
		{
			 alert("Please enter valid Mobile Number.");
			 frm.txtmobile.value='';
			 frm.txtmobile.select();
			 return false;
		}
		hideDivFacilityCoupon();
		showDivPrintCoupon(frm.txtname.value,frm.txtusername.value,frm.txtmobile.value,sp);
		return;
	}
	