function showpopup(URL, name, width, height, resizable, scrollbars, location, toolbar, menubar) {
	var openURL = URL;
	if (URL.indexOf("http://") != 0)
		openURL = "" + URL;
	
	var options = "";
		
	if (resizable == 0)
		options = ",resizable=0";
	else
		options = ",resizable=1";
	
	if (scrollbars == 1)
		options += ",scrollbars=1";
	else
		options += ",scrollbars=0";
	
	if (location == 1)
		options += ",location=1";
	else
		options += ",location=0";

	if (toolbar == 1)
		options += ",toolbar=1";
	else
		options += ",toolbar=0";
			
	if (menubar == 1)
		options += ",menubar=1";
	else
		options += ",menubar=0";

	window.open(openURL, name, "width=" + width + ",height=" + height + options);
	
	//alert(options);
}

function showpopupnormal(URL, name, width, height) {
	showpopup(URL, name, width, height, 1, 1, 1, 1, 1, 1);
}

function showpopuponce(URL, name, width, height, resizable, scrollbars, location, toolbar, menubar) {
	if (get_cookie(name)==''){
		showpopup(URL, name, width, height, resizable, scrollbars, location, toolbar, menubar);
		document.cookie= name + "=yes";
	}
}

function get_cookie(Name) {
	var search = Name + "=";
	var returnvalue = "";
	
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		
		if (offset != -1) { // if cookie exists
			offset += search.length;
			
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			
			// set index of end of cookie value
			if (end == -1)
			 end = document.cookie.length;
			
			returnvalue=unescape(document.cookie.substring(offset, end));
		}
	}
	
	return returnvalue;
}

