﻿function check_login(logId) {
checklogId=isNaN(logId);	
if(checklogId){		
		bhw_js('') ;
		return false;
		}
}
function check_login_useraction(logId,action) {
checklogId=isNaN(logId);	
if( (checklogId) || (logId=='')){		
		bhw_js(action) ;
		return false;
		}
}
function bhw_js(action) {	
if(action!=''){
var user_action ='&action='+action;
//alert(user_action);
}

if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
  }

var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
var browserName=navigator.appName;
if (browserName=="Microsoft Internet Explorer")
{
var hne = document.getElementsByTagName('body')[0].scrollHeight;
}
else
{
var hne = document.getElementsByTagName('html')[0].scrollHeight;
}

var hne = hne+30;

var aboveheight = myHeight-338;
var aboveheight1 = aboveheight/2+h;
var iewidth = myWidth-595;
var iewidth1 = iewidth/2;
document.getElementById('message2').style.top=aboveheight1+'px';
document.getElementById('message2').style.left=iewidth1+'px';
document.getElementById('message2').style.display='block';

var d = new Date();
var epoch_time =(d.getTime()-d.getMilliseconds())/1000;
var randomnumber=Math.floor(Math.random()*9999);
var randomnumber1=Math.floor(Math.random()*9999);
var ran_num=randomnumber+"."+epoch_time+"."+randomnumber1;
var changurl='?no='+ran_num;
document.getElementById('message3').innerHTML='<iframe src="http://www.bhaskar.com/dainikbhaskar2010/contest/bawardslogin.php'+changurl+user_action+'" id="drIfrmId" width="575" frameborder="0" height="330" scrolling="auto"></iframe>';
document.getElementById('mailblack').style.display='block';
document.getElementById('mailblack').style.height=hne+'px';
}

function bhw_js_close() 
{
document.getElementById('mailblack').style.display='none';
document.getElementById('message2').style.display='none';
document.getElementById('message3').innerHTML='';
}




function bhw_js_reg() 
{
//alert('bhw_js_reg');
if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
  }

var h = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
var hne = document.body.clientHeight;
var hne = hne+30;


var aboveheight = myHeight-338;
var aboveheight1 = aboveheight/2+h;
var iewidth = myWidth-595;
var iewidth1 = iewidth/2;
document.getElementById('message2').style.top=aboveheight1+'px';
document.getElementById('message2').style.left=iewidth1+'px';
document.getElementById('message2').style.display='block';
document.getElementById('message3').innerHTML='<iframe src="/dainikbhaskar2010/contest/register.php" id="drIfrmId" width="575" frameborder="0" height="370" scrolling="auto"></iframe>';
document.getElementById('mailblack').style.display='block';
document.getElementById('mailblack').style.height=hne+'px';
}






function saved_article(id,title) {
//alert(id);
//alert(title);
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
		//alert(xmlhttp.responseText);
	 document.getElementById("saved_article_id").innerHTML=xmlhttp.responseText;	
	}
  }  
xmlhttp.open("GET","/dainikbhaskar2010/contest/saved_article.php?id="+id+'&title='+title,true);
xmlhttp.send();
}






