// JavaScript Document

function doAjax(strURL,strPostData,strObj,method,strProgressMessage,nTime) {

	

    var xmlHttpReq = false;

    var self = this;

	setCookie('filename',strURL,1);

    // Mozilla/Safari

	www=(window.location.href.toLowerCase().indexOf("//www.")>0)?"http://www.":"http://";

	strURL=strURL.replace("http://",www);

	var testimg='<table width="100%"  align="center"><tr><td height="500" align="center" valign="middle">'+strProgressMessage+'</td></tr></table>';

	//var testimg='<table width="100%"  align="center"><tr><td align="center" valign="middle"><img src=../images/newsletterthumb/indicator_big.gif></td></tr></table>';

	//alert(testimg);//<img src=../images/newsletterthumb/indicator_big.gif>

	updateMessage(strObj,testimg);

    if (window.XMLHttpRequest) {

        self.xmlHttpReq = new XMLHttpRequest();

    }

    // IE

    else if (window.ActiveXObject) {

        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

    }

	

    self.xmlHttpReq.open(method, strURL, true);

    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    self.xmlHttpReq.onreadystatechange = function() {

        if (self.xmlHttpReq.readyState == 4) 

		{

			

			updateMessage(strObj,self.xmlHttpReq.responseText);

			if (nTime>0) setTimeout("hide('"+strObj+"');",nTime);

        }

    }

    self.xmlHttpReq.send(strPostData);

}



function updateMessage(obj,str)

{

	show(obj);	

	

	document.getElementById(obj).innerHTML=str;

}



function showHide(id)

{

	if (document.getElementById(id).style.display=='')

		document.getElementById(id).style.display='none';

	else

		document.getElementById(id).style.display='';

		

}

function show(id)

{

		document.getElementById(id).style.display='';

		

}

function hide(id)

{

		document.getElementById(id).style.display='none';

}





function getCookie(c_name)

{

	if (document.cookie.length>0)

	{

	c_start=document.cookie.indexOf(c_name + "=");

			if (c_start!=-1)

			{

			c_start=c_start + c_name.length+1;

			c_end=document.cookie.indexOf(";",c_start);

			if (c_end==-1) c_end=document.cookie.length;

			return unescape(document.cookie.substring(c_start,c_end));

			}

	}

return "";

}





/*function setCookie(c_name,value,expiredays)

{

var exdate=new Date();

exdate.setDate(exdate.getDate()+expiredays);

document.cookie=c_name+ "=" +escape(value)+

((expiredays==null) ? "" : ";expires="+exdate.toGMTString());

}*/



function setCookie(c_name,value,nHrs)

{

	var today = new Date();

 var expire = new Date();

 //alert(value);

 if (nHrs==null || nHrs==0) nHrs=1;

 expire.setTime(today.getTime() + 3600000*nHrs);

 document.cookie = c_name+"="+escape(value)

                 + ";expires="+expire.toGMTString();

}









function getNewPage()

{

	var file=getCookie('filename');

	if(file=="")

	{

			file='newsletter1.html';

	}

	//alert(file);

	//window.parent.doAjax(file,'','cont','get','<img src=../images/newsletterthumb/indicator_big.gif>','');

	

	window.parent.doAjax(file,'','cont','get','','');

}



function desCooky()

{

	var str='newsletter1.html';

	alert('hello');

	setCookie('filename',str,-1);

}
