function CheckMaxLength(Object, MaxLen)
{
	document.getElementById('t').innerHTML=Object.value.length + '/100';
	if(Object.value.length > MaxLen) 
	{ 
		//alert("Your Message Length should Not Greater Than 100 Character.");
		Object.value = Object.value.substring(0, MaxLen);
		document.getElementById('t').innerHTML=Object.value.length + '/100';
	}
}
function delete_cookie( cookie_name )
{
	var cookie_date = new Date ( );  // current date & time
	cookie_date.setTime ( cookie_date.getTime() - 1 );
	document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
function  get_ResFrm()
{
	if( (cookie = getCookie1("newResponse")) > "")
	{
		var strReplaceAll = cookie;
		var intIndexOfMatch = strReplaceAll.indexOf( "XXX" );
		while (intIndexOfMatch != -1){
		strReplaceAll = strReplaceAll.replace( "XXX","\n" )
		intIndexOfMatch = strReplaceAll.indexOf( "XXX" );
		}
		document.ResponseForm.contact_message.value = strReplaceAll;
	}
}
function Response_Chk()
{
	window.onerror=null;
	var width = window.screen.width;
	var height = window.screen.height;
	var plateform = navigator.platform;
	if (navigator.javaEnabled() < 1) 
		var java ="No";
	if (navigator.javaEnabled() == 1) 
		var java="Yes";
	var resolution=width+"x"+height+" || OS="+plateform+" || JAVA ENABLE= "+java;
	document.ResponseForm.resolution.value=resolution;
	if(ltrim(document.ResponseForm.contact_message.value) =='')
	{
		alert("Please Enter Comments");
		document.ResponseForm.contact_message.focus();
		return false;
	}

	if(ltrim(document.ResponseForm.contact_name.value) == '')
	{
		alert("Kindly Enter Your Name");
		document.ResponseForm.contact_name.focus();
		return (false);
	}

	if(document.ResponseForm.contact_email.value == '')
	{
		alert("Kindly Enter Your Email ID");
		document.ResponseForm.contact_email.focus();
		return (false);
	}

	if (document.ResponseForm.contact_email.value && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.ResponseForm.contact_email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		document.ResponseForm.contact_email.focus();
		return (false);
	}
	var Phone=document.ResponseForm.contact_phone
	if ((Phone.value) && (checkInternationalPhone(Phone.value)==false)){
			alert("Please Enter a Valid Phone Number")
			Phone.value=""
			Phone.focus()
			return false
	}
	return true
}
function setCookie(name,value)
{
	expires = new Date();
	expires.setTime (expires.getTime() + 24 * 60 * 60 * 15);

	if (value.length > 0)
	document.cookie = name + "=" + escape(value)+ ";"+"path=/;"+"expires=" + expires.toGMTString()+";"
}
function getCookie1(Name)
{
	var search = Name + "="
	if (document.cookie.length > 0)
	{ // if there are any cookies
		offset = document.cookie.indexOf(search)

		if (offset != -1)
		{ // if cookie exists
			offset += search.length

			// set index of beginning of value
			end = document.cookie.indexOf(";", offset)

			// set index of end of cookie value
			if (end == -1) end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}

	return "";
}
function set_ResFrm()
{
	var strReplaceAll = document.ResponseForm.contact_message.value;
	var intIndexOfMatch = strReplaceAll.indexOf( "\n" );
	while (intIndexOfMatch != -1){
	strReplaceAll = strReplaceAll.replace( "\n", "XXX" )
	intIndexOfMatch = strReplaceAll.indexOf( "\n" );
	}
	var newCookie = strReplaceAll;
	setCookie1("newResponse",newCookie);
	return true;
}
function Sms_Chk()
{
	window.onerror=null;
	var width = window.screen.width;
	var height = window.screen.height;
	var plateform = navigator.platform;
	if (navigator.javaEnabled() < 1) 
		var java ="No";
	if (navigator.javaEnabled() == 1) 
		var java="Yes";
	var resolution=width+"x"+height+" || OS="+plateform+" || JAVA ENABLE= "+java;
	document.ResponsemessageForm.resolution.value=resolution;
	if(ltrim(document.ResponsemessageForm.C_Message.value) =='' || document.ResponsemessageForm.C_Message.value=='Enter Your Message.')
	{
		alert("Please Message");
		document.ResponsemessageForm.C_Message.focus();
		return false;
	}
	if(ltrim(document.ResponsemessageForm.C_Name.value) == '' || document.ResponsemessageForm.C_Name.value=='Enter Your Name.')
	{
		alert("Kindly Enter Your Name");
		document.ResponsemessageForm.C_Name.focus();
		return (false);
	}
	if(ltrim(document.ResponsemessageForm.C_Mobile.value) == '')
	{
		alert("Kindly Enter Your 10 Digit Mobile No.");
		document.ResponsemessageForm.C_Mobile.focus();
		return (false);
	}
	if(document.ResponsemessageForm.C_Mobile.value)
	{
		if(isInteger(document.ResponsemessageForm.C_Mobile.value) == false)
		{
			alert("Kindly Enter a Valid Mobile No..");
			document.ResponsemessageForm.C_Mobile.focus();
			return false;
		}
				
		if ((document.ResponsemessageForm.C_Mobile.value.length < 10) || document.ResponsemessageForm.C_Mobile.value.length > 12)
		{
			alert("Kindly Enter Your 10 Digit Mobile No.");
			document.ResponsemessageForm.C_Mobile.focus();
			return false;
		}
	}	
	var mobile=document.ResponsemessageForm.C_Mobile.value.split("");
	if(mobile[0]!=9)
	{
		alert("Your Mobile Number Must Start with 9.\n Example: 9312098968");
		document.ResponsemessageForm.C_Mobile.focus();
		return false;
	}
		
	if(ltrim(document.ResponsemessageForm.C_Verifycode.value) == '')
	{
		alert("Kindly Enter Verify Code.");
		document.ResponsemessageForm.C_Verifycode.focus();
		return (false);
	}
	if(document.ResponsemessageForm.C_Verifycode && document.ResponsemessageForm.C_Verifycode.value =='')
	{
		alert("Please Enter Verification Code");
		document.ResponsemessageForm.C_Verifycode.focus();
		return (false);
	}	
	return true
}
function OutText(obj,txt)
{
	if(obj.value=="")
	{
		obj.value=txt;
	}
}
function InText(obj,txt)
{
	if(obj.value==txt)
	{
		obj.value="";
	}
}
function toggleSource( id )
{
	var elem
	var link
	if( document.getElementById )
	{
		elem = document.getElementById( id )
		link = document.getElementById( "l_" + id )
	}
	else if ( document.all )
	{
		elem = eval( "document.all." + id )
		link = eval( "document.all.l_" + id )
	}
	else
	{
		return false;
	}
	if( elem.style.display == "block" )
	{
		elem.style.display = "none"
		link.innerHTML = '[Send Free SMS] <img src="/gifs/red-arrow-down.gif" border="0"/>'
	}
	else
	{
		elem.style.display = "block"
		link.innerHTML = 'Close [X]'
	}
}
function openLargeAdImage(url,id)
{
	setCookie('picid',id);
aWindow=window.open(url,"","toolbar=no,width=400,height=400,status=no,scrollbars=no,resize=no,menubars=no");
	aWindow.focus();
}
function openLargeImage(url)
{
	aWindow=window.open(url,"","toolbar=no,width=400,height=400,status=no,scrollbars=no,resize=no,menubars=no");
	aWindow.focus();
}
function openWin2(url,w,h)
{
	aWindow=window.open(url,"","toolbar=no,width="+w+",height="+h+",status=no,scrollbars=no,resize=no,menubars=no");
	aWindow.focus();
}