function xmlhttpGet(strURL, divName, alignCenter) {
	var xmlHttpReq = false;
	var self = this;
	var alignText = '';
	var divHeight;
	var marginTop;
	
	document.getElementById(divName).style.textAlign = 'center';
	if (alignCenter) {
		divHeight = document.getElementById(divName).offsetHeight;
		marginTop = parseInt((divHeight - 16) / 2);
		alignText = "style='margin-top:"+marginTop+"px;'";
		document.getElementById(divName).style.height = divHeight + 'px';
	}

	document.getElementById(divName).innerHTML = "<img src='/images/hot/ajax_loader.gif' border='0' "+alignText+" />";
	
	if (window.XMLHttpRequest) {
		self.xmlHttpReq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		self.xmlHttpReq = new ActiveXObject('Microsoft.XMLHTTP');
	};
		self.xmlHttpReq.open('GET', strURL);
		self.xmlHttpReq.onreadystatechange = function() {
			if (self.xmlHttpReq.readyState == 4) {
				if (alignCenter) {
					document.getElementById(divName).style.height = '';
				}
				document.getElementById(divName).innerHTML = self.xmlHttpReq.responseText;
			};
		};
	self.xmlHttpReq.send(null);
};

/* ------------------- Jump page label without changing the URL ---------------------------*/
	function ScrollToElement(theElement){
		var selectedPosX = 0;
		var selectedPosY = 0;
		while(theElement != null){
			selectedPosX += theElement.offsetLeft;
			selectedPosY += theElement.offsetTop;
			theElement = theElement.offsetParent;
		}
		window.scrollTo(selectedPosX,selectedPosY);
	}


/* ------------------- standalone Cookie Actions ---------------------------*/
function setCookie (name,val, days, path) {
	if (days) {
		var date = new Date( days * 86400000 + (new Date()).getTime());
		var expires = ';expires='+date.toGMTString()+'; path='+path+';';
	}
	else var expires = '; path='+path+';';
	document.cookie = name+'='+val+expires;
}

// checking if cookies are enabled
function checkCookieEnabled () {
	var cookieEnabled=(navigator.cookieEnabled)? true : false
	//if not IE4+ nor NS6+
	if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
		document.cookie="testcookie"
		cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
	}
	//return cookieEnabled;
	return true;
}

// read the cookie by name and returns the value, if param isn't set then return null
function readCookie (name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


/* ------------------- Finding absolute position functions ----------------------- */
function findPosX(obj) {
	var curleft = 0;
	if(obj.offsetParent)
		while(1)
		{
			curleft += obj.offsetLeft;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	else if(obj.x)
	curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if(obj.offsetParent)
		while(1)
		{
			curtop += obj.offsetTop;
			if(!obj.offsetParent)
				break;
			obj = obj.offsetParent;
		}
	else if(obj.y)
	curtop += obj.y;
	return curtop;
}

/////////////////////////////////////////////////////////////////////////////////////
/* ------------------- Flash Functions ----------------------- */
function flashPopUp (url,ispopup,istoolbar,width,height) {
	if (url == 'NoURL') return false;
	if (ispopup!="false") {
		if(width <= 0) var theWidth=680;
		if(height <= 0) var theHeight=500;
		if(width <= 0 && width <= 0) {
			window.open(url,'Ynet','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+theWidth+',height='+theHeight);
		} else {
			if(istoolbar=='true') {
				window.open(url,'Ynet','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+width+',height='+height);
			} else {
				window.open(url,'Ynet','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,movable=yes,resizable=yes,width='+width+',height='+height);
			}
		}
	} else { 
		parent.window.location = url; 
	}
}
/////////////////////////////////////////////////////////////////////////////////////
