var y1 = 150;   // change the # on the left to adjuct the Y co-ordinate
(document.getElementById) ? dom = true : dom = false;

function hideIt() 
{
  if (dom) {document.getElementById("div_rediffmail").style.visibility='hidden';}
  if (document.layers) {document.layers["div_rediffmail"].visibility='hide';} 
  
  Set_Cookie( 'Rsc', 'test',1, '/', '', '' );
  Set_Cookie( 'Rl', 'set',1, '/', '', '' );
}

function showIt() 
{
		
  if (dom) 
  {
	  document.getElementById("div_rediffmail").style.visibility='visible';
  }
  if (document.layers) 
  {
	  	document.layers["div_rediffmail"].visibility='show';
  } 
}

function placeIt()
{
  if (dom && !document.all) 
  {
	  document.getElementById("div_rediffmail").style.top = window.pageYOffset + (window.innerHeight - (window.innerHeight-y1))
  }
  if (document.layers) 
  {
	  document.layers["div_rediffmail"].top = window.pageYOffset + (window.innerHeight - (window.innerHeight-y1))
  }
  if (document.all)
  {
	  document.all["div_rediffmail"].style.top = document.body.scrollTop + (document.body.clientHeight - (document.body.clientHeight-y1));
  }
  window.setTimeout("placeIt()", 10);   
}
//window.setTimeout("hideIt()", 10000); 
window.onload=placeIt;setInterval('blinkIt()',500);
onResize="window.location.href = window.location.href"

function Set_Cookie( name, value, expires, path, domain, secure )
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function getcookie(n)
{
	var ck=document.cookie;
	//alert('cookies after set function:-' + ck)
	var ar=n+"=";
	var al=ar.length;
	var cl=ck.length;
	var i=0;
	while(i<cl)
	{
		j=i+al;
		if(ck.substring(i,j)==ar)
		{
			e=ck.indexOf(";",j);
			if(e==-1)
				e=ck.length;return unescape(ck.substring(j,e));
		}
		i=ck.indexOf(" ",i)+1;
		if(i==0)
		break;
	}
	return "";
}

function trimAll(sString) 
	{
		while (sString.substring(0,1) == ' ')	
		{
			sString = sString.substring(1, sString.length);
		}
		while (sString.substring(sString.length-1, sString.length) == ' ')
		{
			sString = sString.substring(0,sString.length-1);
		}
		return sString;
	}
	function chkLogin()
	{		
		var yrname=trimAll(document.getElementById("name").value);
		var yremail=trimAll(document.getElementById("email").value);
		var yrmobile=trimAll(document.getElementById("mobilenum").value);
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		
		if (yrname =="" || yrname =="Your Name")
		{
		alert("Please Enter Your Name.");
		document.loginform.name.focus();
		return false;
		}
		if (yremail =="")
		{
		alert("Please Enter Email Id");
		document.loginform.email.focus();
		return false;
		}
		if (filter.test(yremail)==false)
				{
				alert("Please input a valid email address!");
				document.loginform.email.focus();
				return false;
				}
		if (yrmobile=="")
		{
			alert("Please Enter Your Mobile No.");
			document.loginform.mobilenum.value="";
			document.loginform.mobilenum.focus();
			return false;
		}	
		if (isNaN(yrmobile))
		{
			alert("Please Enter Valid Mobile No.");
			document.loginform.mobilenum.value="";
			document.loginform.mobilenum.focus();
			return false;
		}
		if (yrmobile.charAt(0) != "9")
		{
			alert("First number needs to be a 9!")
			document.loginform.mobilenum.value="";
			document.loginform.mobilenum.focus();
			return false;
		} 
		if (yrmobile.length < 10) 
		{
			alert ("Mobile Number should be 10 digits long !");
			document.loginform.mobilenum.focus();
			return false;
		}
	}
function ValidNews()
{
	var newsemail=trimAll(document.getElementById("newsemail").value);
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (newsemail =="")
		{
		alert("Please Enter Email Id");
		document.newsletter.newsemail.focus();
		return false;
		}
		if (filter.test(newsemail)==false)
				{
				alert("Please input a valid email address!");
				document.newsletter.newsemail.focus();
				return false;
				}
}




