

String.prototype.trim = function()
	{
		a = this.replace(/^\s+/, '');
		return a.replace(/\s+$/, '');
	};
	
//ajax call invoking
	function ajaxRequest(url, handler)
	{
		xmlHttp = GetXmlHttpObject(handler);
		xmlHttp.open("GET", url , true);
		xmlHttp.send(null);
	}
//ajax call initialisation
	function GetXmlHttpObject(handler)
	{
		var objXmlHttp = null;
		try {
			objXmlHttp = new XMLHttpRequest();
			objXmlHttp.onreadystatechange = handler;
			return objXmlHttp;
		} catch(e) {
			try {
				objXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
				objXmlHttp.onreadystatechange = handler; 
				return objXmlHttp;
			} catch (e) { 
				try {
					objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
					objXmlHttp.onreadystatechange = handler; 
					return objXmlHttp;
				} catch (e) {
					return false;
				}
			}
		}
		return false;
	}

// ajax call end

// share start
	function sendSharevalues()
	{
		if(ShareVal())
		{
			
			url = "ajax.php?yourname="+document.forms.shareFrm.yname.value+"&youremail="+document.forms.shareFrm.ymail.value+"&friendname="+document.forms.shareFrm.frdname.value+"&friendemail="+document.forms.shareFrm.frdmail.value+"&message="+document.forms.shareFrm.message.value+"&videoId="+document.forms.shareFrm.videoId.value;
			ajaxRequest(url, shareAlert);
		}
	}
	function shareAlert()
	{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			res = xmlHttp.responseText.trim();
			if(res == 2)
			{
				document.getElementById('ShareErrid').style.display = "none";
				document.getElementById('ShareSuccessId').style.display = "block";
			}
			else
			{
				document.getElementById('ShareSuccessId').style.display = "none";
				document.getElementById('ShareErrid').style.display = "block";
			}
			return false
		}
	}
// share end

			
// share start
	function sendContactvalues()
	{
		if(ContactVal())
		{
			
			url = "ajax.php?yourEmail="+document.forms.contactfrm.youremail.value+"&subject="+document.forms.contactfrm.subject.value+"&message="+document.forms.contactfrm.contmessage.value+"&vercode="+document.forms.contactfrm.txtCaptcha.value;
			ajaxRequest(url, contactAlert);
		}
	}
	function contactAlert()
	{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			res = xmlHttp.responseText.trim();
			if(res==3)	
			{			
				document.getElementById('CodeId').style.display="block";
				document.getElementById('ContactSuccessId').style.display = "none";
				document.getElementById('ContactErrid').style.display = "none";
			}
			 else if(res == 2)
			{
				document.getElementById('ContactSuccessId').style.display = "block";
				document.getElementById('ContactErrid').style.display = "none";
				document.getElementById('CodeId').style.display="none";
				document.forms.contactfrm.youremail.value="";
				document.forms.contactfrm.subject.value="";
				document.forms.contactfrm.contmessage.value="";
				document.forms.contactfrm.txtCaptcha.value="";
				getParam(document.contactfrm);
			}
			else
			{
				
				document.getElementById('ContactErrid').style.display = "block";
				document.getElementById('CodeId').style.display	="none";
				document.getElementById('ContactSuccessId').style.display = "none";
			}
			return false
		}
	} 
// share end
	






	
