var url = window.location.href;
var nohttp = url.split('//')[1];
var hostPort = nohttp.split('/')[0];

//var site_url = "http://"+hostPort+"/";
var site_url = "http://www.islamonline.com/";


var xmlHttp_viewed_box;
var xmlHttp_rightmenu_boxes;
var xmlHttp_poll_box;
var xmlHttp_art_comments;
var xmlHttp_art_comments_count;
var xmlHttp_date_time;
var xmlHttp_date_time_forex;
var xmlHttp_related_articles;
var xmlHttp_latest_articles;

var id_viewed_box;
var id_rightmenu_boxes;
var id_poll_box;
var id_art_comments;
var id_art_comments_count;
var id_date_time;
var id_date_time_forex;
var id_related_articles;
var id_latest_articles;

function show_viewed_box()
{
	id_viewed_box = "div_viewed_box";
	var url_viewed_box=site_url+"get_viewed_box.php";
	xmlHttp_viewed_box=GetXmlHttpObject(stateChanged_viewed_box);
	xmlHttp_viewed_box.open("GET", url_viewed_box , true);
	xmlHttp_viewed_box.send(null);
}

function stateChanged_viewed_box() 
{ 
	if (xmlHttp_viewed_box.readyState==4 || xmlHttp_viewed_box.readyState=="complete")
	{ 
		document.getElementById(id_viewed_box).innerHTML=xmlHttp_viewed_box.responseText ;
	}
} 
 
function show_rightmenu_boxes(str)
{
	id_rightmenu_boxes = "div_rightmenu_boxes";
	var url_rightmenu_boxes=site_url+"get_rightmenu_boxes.php?artid=" + str;
	xmlHttp_rightmenu_boxes=GetXmlHttpObject(stateChanged_rightmenu_boxes);
	xmlHttp_rightmenu_boxes.open("GET", url_rightmenu_boxes , true);
	xmlHttp_rightmenu_boxes.send(null);
}

function stateChanged_rightmenu_boxes() 
{ 
	if (xmlHttp_rightmenu_boxes.readyState==4 || xmlHttp_rightmenu_boxes.readyState=="complete")
	{ 
		document.getElementById(id_rightmenu_boxes).innerHTML=xmlHttp_rightmenu_boxes.responseText ;
	}
} 

function show_related_articles(str)
{
    id_related_articles = "div_related_articles";
    var url_related_articles=site_url+"get_related_articles.php?artid=" + str;
    xmlHttp_related_articles=GetXmlHttpObject(stateChanged_related_articles);
    xmlHttp_related_articles.open("GET", url_related_articles , true);
    xmlHttp_related_articles.send(null);
}

function stateChanged_related_articles() 
{ 
    if (xmlHttp_related_articles.readyState==4 || xmlHttp_related_articles.readyState=="complete")
    { 
        document.getElementById(id_related_articles).innerHTML=xmlHttp_related_articles.responseText ;
    }
}

function show_latest_articles()
{
    id_latest_articles = "ticker-wrapper";
    var url_latest_articles=site_url+"get_latest_article.php";
    xmlHttp_latest_articles=GetXmlHttpObject(stateChanged_latest_articles);
    xmlHttp_latest_articles.open("GET", url_latest_articles , true);
    xmlHttp_latest_articles.send(null);
}

function stateChanged_latest_articles() 
{ 
    if (xmlHttp_latest_articles.readyState==4 || xmlHttp_latest_articles.readyState=="complete")
    { 
        document.getElementById(id_latest_articles).innerHTML=xmlHttp_latest_articles.responseText ;
    }
}

function show_poll_box()
{
	id_poll_box = "div_poll_box";
	var url_poll_box=site_url+"get_poll_box.php";
	xmlHttp_poll_box=GetXmlHttpObject(stateChanged_poll_box);
	xmlHttp_poll_box.open("GET", url_poll_box , true);
	xmlHttp_poll_box.send(null);
}

function stateChanged_poll_box() 
{ 
	if (xmlHttp_poll_box.readyState==4 || xmlHttp_poll_box.readyState=="complete")
	{ 
		document.getElementById(id_poll_box).innerHTML=xmlHttp_poll_box.responseText ;
	}
}

function show_art_comments(str)
{
	id_art_comments = "div_art_comments";
	var url_art_comments=site_url+"news/get_comments.php?artid=" + str;
	xmlHttp_art_comments=GetXmlHttpObject(stateChanged_art_comments);
	xmlHttp_art_comments.open("GET", url_art_comments , true);
	xmlHttp_art_comments.send(null);
}

function stateChanged_art_comments() 
{ 
	if (xmlHttp_art_comments.readyState==4 || xmlHttp_art_comments.readyState=="complete")
	{ 
		document.getElementById(id_art_comments).innerHTML=xmlHttp_art_comments.responseText ;
	}
}  

function show_art_comments_count(str)
{
	id_art_comments_count = "div_art_comments_count";
	var url_art_comments_count=site_url+"news/get_comments_count.php?artid=" + str;
	xmlHttp_art_comments_count=GetXmlHttpObject(stateChanged_art_comments_count);
	xmlHttp_art_comments_count.open("GET", url_art_comments_count , true);
	xmlHttp_art_comments_count.send(null);
}

function stateChanged_art_comments_count() 
{ 
	if (xmlHttp_art_comments_count.readyState==4 || xmlHttp_art_comments_count.readyState=="complete")
	{ 
		document.getElementById(id_art_comments_count).innerHTML=xmlHttp_art_comments_count.responseText ;
	}
} 

function show_date_time()
{
	id_date_time = "div_date_time";
	var url_date_time=site_url+"get_date_time.php";
	xmlHttp_date_time=GetXmlHttpObject(stateChanged_date_time);
	xmlHttp_date_time.open("GET", url_date_time , true);
	xmlHttp_date_time.send(null);
}

function stateChanged_date_time() 
{ 
	if (xmlHttp_date_time.readyState==4 || xmlHttp_date_time.readyState=="complete")
	{ 
		document.getElementById(id_date_time).innerHTML=xmlHttp_date_time.responseText;
	}
} 

function show_date_time_forex()
{
	id_date_time_forex = "div_date_time_forex";
	var url_date_time_forex=site_url+"get_date_time_forex.php";
	xmlHttp_date_time_forex=GetXmlHttpObject(stateChanged_date_time_forex);
	xmlHttp_date_time_forex.open("GET", url_date_time_forex , true);
	xmlHttp_date_time_forex.send(null);
}

function stateChanged_date_time_forex() 
{ 
	if (xmlHttp_date_time_forex.readyState==4 || xmlHttp_date_time_forex.readyState=="complete")
	{ 
		document.getElementById(id_date_time_forex).innerHTML=xmlHttp_date_time_forex.responseText ;
	}
} 

function GetXmlHttpObject(handler)
{
	var objXmlHttp=null;
	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This code doesn't work in Opera") ;
		return ;
	}
	
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName="Msxml2.XMLHTTP";
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
	{
	strName="Microsoft.XMLHTTP";
} 

try
{ 
	objXmlHttp=new ActiveXObject(strName);
	objXmlHttp.onreadystatechange=handler ;
	return objXmlHttp;
} 
catch(e)
{ 
	alert("Error. Scripting for ActiveX might be disabled");
	return;
} 
}
	
if (navigator.userAgent.indexOf("Mozilla")>=0)
{
	objXmlHttp=new XMLHttpRequest();
	objXmlHttp.onload=handler;
	objXmlHttp.onerror=handler;
	return objXmlHttp;
}
}
