
function get_ipl_login()
{
	document.location.href="/z/login/login.php?go=/zones/ipl2020";
}

function show_ipl_fav()
{
	if(xmlHttpReq.readyState == 4)
	{
		if(xmlHttpReq.status == 200)
		{
				document.getElementById("fav_id").innerHTML = xmlHttpReq.responseText;
		}
		else
		{
			alert("Error: While trying to fetch records, please try again later");
		}
	}
	else
	{
		document.getElementById("fav_id").innerHTML = "<img src=\"/zones-ssi/js-css-images/loading.gif\" border=\"0\" alt=\"Loading...\">";
	}//end of else
}


function display_layer_center_onpage(obj_div)
{

	var hrefDiv = document.getElementById(obj_div);
	hrefDiv.style.display = "block";

	hrefDiv.innerHTML = "";

	var bheight = document.body.clientHeight;
	var bwidth = document.body.clientWidth;		

	var scrolly = document.body.scrollTop;
	var scrollx = document.body.scrollLeft;
	
	var layr_ht = hrefDiv.offsetHeight;
	var layr_wd = hrefDiv.offsetWidth;

	var aa = Math.ceil(layr_ht/2);
	var bb = Math.ceil(layr_wd/2);

	var c = Math.ceil(bheight/2);
	var d = Math.ceil(bwidth/2);

	var disp_layer_top_st = c + scrolly - aa ;
	var disp_layer_width_st = d + scrollx - bb;

	//for Mozilla
	hrefDiv.setAttribute("style","display: block;position: absolute ;top: "+disp_layer_top_st+"px;left: "+disp_layer_width_st+"px; border: 6px solid #333333; z-index:1010; background: #ffffff;");

	//for IE
	hrefDiv.style.cssText = "display: block;position: absolute ;top: "+disp_layer_top_st+"px;left: "+disp_layer_width_st+"px; border: 6px solid #333333; z-index:1010; background: #ffffff;";

}//EO

function findIplPos(obj) {
	if(obj)
	{
		var curleft = curtop = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			}
		}
		

		document.getElementById('fade_id').style.height = curtop;
		document.getElementById('fade_id').style.display = 'block';
	}
}

function handlerdivIdIplLayer(handler)
{

	if(xmlHttpReq.readyState == 4)
	{
		if(xmlHttpReq.status == 200)
		{
			document.getElementById(handler).innerHTML = xmlHttpReq.responseText;
			show_ipl_layer(handler);
		}
		else
		{
			alert("Error: While trying to fetch records, please try again later");
		}
	}
	else
	{
		display_layer_center_onpage(handler);
		document.getElementById(handler).innerHTML = "<div style=\"padding: 10px;\"><img src=\"/zones-ssi/js-css-images/please-wait.gif\" border=\"0\" alt=\"please wait...\" align=\"absmiddle\"></div>";
	}
}

function show_ipl_layer(obj_div)
{
	var hrefDiv = document.getElementById(obj_div);


	var bheight = document.body.clientHeight;
	var bwidth = document.body.clientWidth;		

	var scrolly = document.body.scrollTop;
	var scrollx = document.body.scrollLeft;
	
	hrefDiv.style.display = "block";
	
	var layr_ht = hrefDiv.offsetHeight;
	var layr_wd = hrefDiv.offsetWidth;

	var aa = Math.ceil(layr_ht/2);
	var bb = Math.ceil(layr_wd/2);
	
	var c = Math.ceil(bheight/2);
	var d = Math.ceil(bwidth/2);

	var disp_layer_top_st = c + scrolly - aa ;
	var disp_layer_width_st = d + scrollx - bb;

	if(disp_layer_top_st < 1)
		disp_layer_top_st = 10;
	//for Mozilla
	hrefDiv.setAttribute("style","display: block;position: absolute ;top: "+disp_layer_top_st+"px;left: "+disp_layer_width_st+"px;border: 6px solid #333333; z-index:1010; background: #ffffff;");

	//for IE
	hrefDiv.style.cssText = "display: block;position: absolute ;top: "+disp_layer_top_st+"px;left: "+disp_layer_width_st+"px; ;border: 6px solid #333333; z-index:1010; background: #ffffff;";

	//document.getElementById('fade_id').style.display="block";
	return;
}//EO

function clear_n_hide_ipl_layer(obj_div)
{
	var hrefDiv = document.getElementById(obj_div);
	hrefDiv.innerHTML = "";
	hrefDiv.style.display = "none";
	document.getElementById('fade_id').style.display = 'none';
	if(document.getElementById('share_element'))
			document.getElementById('share_element').style.display = 'none';
}

function light_stars(postid, position)
{
	var site_name = "";
	site_name = document.getElementById("image_site_name").value;
	for (i=1;i<=5;i++)
	{
		if(i <= position)
		{
			document.getElementById("star_"+postid+"_"+i).src =  site_name + '/zones-images/blog/rating-yellow2.gif';
		}
		else
		{
			document.getElementById("star_"+postid+"_"+i).src =  site_name + '/zones-images/blog/rating-yellow3.gif';
		}
	}
}

function show_stars(postid, position, rating_star_half_mouseout_flag)
{
	var site_name = "";
	site_name = document.getElementById("image_site_name").value;
	for (i=1;i<=5;i++)
	{
		if(i <= position)
		{
			document.getElementById("star_"+postid+"_"+i).src = site_name + '/zones-images/blog/rating-yellow1.gif';
		}
		else if(rating_star_half_mouseout_flag == true)
		{
			rating_star_half_mouseout_flag = false;
			document.getElementById("star_"+postid+"_"+i).src = site_name + '/zones-images/blog/rating-star-half.gif';
		}
		else
		{
			document.getElementById("star_"+postid+"_"+i).src = site_name + '/zones-images/blog/rating-yellow3.gif';
		}
	}
}

function share_ipl_div_content(div_id,gobbler_page,email_page,friendlist_page,zone_page, width, height, visitor_mode)
{
	var hide_fade_div = 0;
	var hide_fade_div_str = "";
	if( div_id == "share_ipl_zone")
	{
		hide_fade_div = 1;
		hide_fade_div_str = " document.getElementById('fade_id').style.display='none'; ";
	}


	if(width == undefined)
		width = 500;

	if(height == undefined)
		height = 550;

	if(document.getElementById(div_id))
		document.getElementById(div_id).style.display = 'block';

	if(document.getElementById('fade_id'))
	{
		document.getElementById('fade_id').style.display = 'block';
	}

	var layer_heading_str = "<span style=\"color: #000;\">Choose recipients using an option below:</span>";
	share_str = "<div align=\"left\" style=\"padding:10px;\"><b>"+layer_heading_str+"</b><br><div style=\"padding: 8px 0px 3px 0px;\">- <a href=\"#\" onClick=\"open_ipl_share_popup('"+gobbler_page+"','','"+div_id+"',520,538,"+hide_fade_div+"); return false;\"  class=\"red\">Select E-mails from your address book on yahoo, gmail etc.</a><br clear=\"all\">- <a href=\"#\" onClick=\"open_ipl_share_popup('"+email_page+"','','"+div_id+"',"+width+", "+height+","+hide_fade_div+"); return false;\" class=\"red\">Enter E-mail addresses manually</a><br clear=\"all\">";


	if(visitor_mode != 'Y')
	{
		share_str += "- <a href=\"#\" onClick=\"open_ipl_share_popup('"+friendlist_page+"','','"+div_id+"',640, 550,"+hide_fade_div+"); return false;\"  class=\"red\">Select from your friends list</a><br>- <a href=\"#\" onClick=\"open_ipl_share_popup('"+zone_page+"','','"+div_id+"',"+width+", "+height+","+hide_fade_div+"); return false;\" class=\"red\">Enter Zonenames</a>";
	}


	share_str += "<br><div style=\"float:right;margin-right=\"10px\"\"><a href=\"#\" onclick = \"document.getElementById('"+div_id+"').style.display='none'; "+hide_fade_div_str+" return false;\" class=\"red\">Close [X]</a></div><br clear=\"all\">";

	document.getElementById(div_id).innerHTML = share_str;
	return false;
}

function show_ipl_share_block(obj_div,dv_width,dv_height)
{

	var hrefDiv = document.getElementById(obj_div);
	hrefDiv.style.display = "block";

	var bheight = document.body.clientHeight;
	var bwidth = document.body.clientWidth;		


	var scrolly = document.body.scrollTop;
	var scrollx = document.body.scrollLeft;

	var layr_ht = hrefDiv.offsetHeight;
	var layr_wd = hrefDiv.offsetWidth;

	var aa = Math.ceil(layr_ht/2);
	var bb = Math.ceil(layr_wd/2);
	
	var c = Math.ceil(bheight/2);
	var d = Math.ceil(bwidth/2);

	var disp_layer_top_st = c + scrolly - aa ;
	var disp_layer_width_st = d + scrollx - bb;
	
	//for Mozilla
	hrefDiv.setAttribute("style","display: block;position: absolute ;top: "+disp_layer_top_st+"px;left: "+disp_layer_width_st+"px; width:"+dv_width+"px; height:"+dv_height+"px; border: 6px solid #333333; z-index:1010; background: #ffffff;");


	//for IE
	hrefDiv.style.cssText = "display: block;position: absolute ;top: "+disp_layer_top_st+"px;left: "+disp_layer_width_st+"px; width:"+dv_width+"px; height:"+dv_height+"px; border: 6px solid #333333; z-index:1010; background: #ffffff;";

}//EO

function open_ipl_share_popup(page,param,div_close,width,height,hide_fade_div)
{
	// ADDED BY DHANESH M
	if(div_close != '')
	{
		document.getElementById(div_close).style.display = 'none';
		
		if(hide_fade_div && document.getElementById('fade_id'))
			document.getElementById('fade_id').style.display = 'none';
		
	}

	window_format = 'top=50,left=200,width='+width+',height='+height+',scrollbars=yes';

	window.open(page+param,'',window_format);
}


function post_reply_check()
{
	if(xmlHttpReq.readyState == 4)
	{
		if(xmlHttpReq.status == 200)
		{
			if(xmlHttpReq.responseText.indexOf("<!--post_reply-->") != null && xmlHttpReq.responseText.indexOf("<!--post_reply-->") != -1)
			{
				/* show the please wait image untill the setTimeout is called */
				document.getElementById('error_div').innerHTML = xmlHttpReq.responseText;
			}
			else
			{
				
				document.getElementById('toggle').innerHTML = xmlHttpReq.responseText;
			}
		}
		else
		{
			alert("Error: While trying to fetch records, please try again later");
		}
	}
	else
	{
		document.getElementById('error_div').innerHTML = "<div style=\"padding: 10px;\"><img src=\"/zones-ssi/js-css-images/loading.gif\" border=\"0\" alt=\"please wait...\" align=\"absmiddle\"></div>";
	}
}