var popUpWindowWidth =700;
var popUpWindowHeight = 700;
var popUpWindow = false; // use either true or false

function showDialog(url, wd, ht){
	var lt = (window.screen.availWidth-wd)/2;
	var tp = (window.screen.availHeight-ht)/2;
	var features = 'scrollbars=1,top='+tp+',left='+lt+',height='+ht+',width='+wd+',menubar=0,resizable=1,titlebar=0';
	var whdl = window.open(url,'wnd', features);
	whdl.focus();
}

function showWindow(url, wd, ht){
	var lt = (window.screen.availWidth-wd)/2;
	var tp = (window.screen.availHeight-ht)/2;
	var features = 'scrollbars=1,top='+tp+',left='+lt+',height='+ht+',width='+wd+',menubar=0,resizable=1,titlebar=0';
	var whdl = window.open(url,'wnd', features);
	whdl.focus();
}

function showPopUpWindow(){
	if(showPopUpWindow && readCookie('popUp')==null){
		createCookie('popUp', 'YES', 1);
		showWindow('popUp.aspx', popUpWindowWidth, popUpWindowHeight);
	}
}

function createCookie(name, value, days){
	if(days){
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}else{
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}

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;
}

function deleteCookie(name){
	createCookie(name,"",-1);
}

showPopUpWindow();