function setCookie( name, value, expiredays, domain ) {
    var today = new Date();
    today.setDate( today.getDate() + expiredays );
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + "; domain=" + domain + ";";
}
         
function popup_close(no,type) {
	var cookieName = "eziscookie" + no;
	var divName = "EzisDiv" + no;
	var nextpopup = "next_popup"+no;
	
	if ( document.getElementById(nextpopup).checked ) {
		setCookie( cookieName, "checked" ,1 ,domain);
    }

	if(type == "win") self.close();	
	else if(type == "div") document.getElementById(divName).style.display = "none";
}

function closeredirect(url) {
    opener.top.location=url; 
    self.close();
}

//parent
function getCookie(strName) {
	var strArg = new String(strName + "=");	
	var nArgLen, nCookieLen, nEnd;
	var i = 0, j;
	
	nArgLen    = strArg.length;
	nCookieLen = document.cookie.length;
	
	if(nCookieLen > 0) {
	
		while(i < nCookieLen) {
		
			j = i + nArgLen;
			
			if(document.cookie.substring(i, j) == strArg) {
				nEnd = document.cookie.indexOf (";", j);
				if(nEnd == -1) nEnd = document.cookie.length;
				return unescape(document.cookie.substring(j, nEnd));
			 
			}
			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
	}
	
	return("");
}
