// subscribePopup.js : 

function subscribePopup() { 

var popupShown = getCookie("popupShown");

// check if already shown or not ...

if (popupShown != "true") {

// so show the popup window

	window.open("subscribe/index.php?fuseaction=sub.subscribe", "popup","height=500,width=400,scrollbars=no"); 
}
 
// set cookie for next time ...

setCookie("popupShown", "true", "", "");


}

// setCookie

function setCookie(cookieName, cookieValue, cookiePath, cookieExpires) {

cookieValue = escape(cookieValue);

if (cookieExpires == "") { 
	var nowDate = new Date(); 
	nowDate.setMonth(nowDate.getMonth() + 6);
	cookieExpires = nowDate.toGMTString();
}

if (cookiePath != "") {
	cookiePath = ";Path=" + cookiePath;
}

document.cookie = cookieName + "=" + cookieValue 
		+ ";expires=" + cookieExpires + cookiePath;
}

function getCookie(name) {

var cookieString = document.cookie; 
var index = cookieString.indexOf(name + "="); 
if (index == -1) { return null; }

index = cookieString.indexOf("=", index) + 1; 
var endstr = cookieString.indexOf(";", index);

if (endstr == -1) { 
	endstr = cookieString.length;
} 
return unescape(cookieString.substring(index, endstr));

}

