if (parent.frames.length > 0) {
	parent.location.href = location.href;
}

//document.body.onresize = function (){
//	alert(window.width);
//}


function toggleClickOpen(id){
	document.getElementById(id).style.display = 
		( document.getElementById(id).style.display == "block" ? "none" : "block" );
}

function OpenNewWindow(url,winwidth,winheight, desc) {
	NewWindow=window.open(url,desc,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,scrollbars=yes,resizable=yes,copyhistory=no,maxbutton=yes,width='+winwidth+',height='+winheight)
	NewWindow.focus()
}

function str_replace(needle, strnew, haystack) {
	var pos = 0;
	while ( haystack.substring(pos).indexOf(needle) != -1 ) {
		pos = pos + haystack.substring(pos).indexOf(needle);
		haystack = haystack.substring(0,pos)+strnew+haystack.substring(pos+needle.length);
		pos = pos + strnew.length;	
	}
	return haystack;
}

function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
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;
}
