function popupnewwindow(url_addr, scroll, w, h)
{	
	var paramstring = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes," + "scrollbars=" + scroll + ",width=" + w + ",height=" + h;
	window.open(url_addr,"_blank",paramstring);
}

function readcookie(name) 
{
    if(document.cookie == '') 
	{	return 0;	} 
	else 
	{	var firstChar, lastChar;
		var wholecookie = document.cookie;
		firstChar = wholecookie.indexOf(name);
		var getstart = firstChar + name.length;
		if((firstChar != -1) && (wholecookie.charAt(getstart) == '=')) 
		{   firstChar += name.length + 1;
		    lastChar = wholecookie.indexOf(';', firstChar);
		    if(lastChar == -1) lastChar = wholecookie.length;
		    return unescape(wholecookie.substring(firstChar, lastChar));	} 
	else 
	{	return 0;	}	
	}	
}

var exit=false;
var limit=1;
var temp=1;

function pop()
{
	temp = readcookie('count') - 0;
		if (document.cookie.indexOf('count=') < 0)
		{	document.cookie = 'count=' + 1; 
			exit = true;	}
		else
		{	
			if ( readcookie('count') < limit)
			{ exit = true; }
			else
			{ exit = false; }
		}
	if (exit)
	{	
		popupnewwindow(url_link, "yes", 400, 400);
		temp = temp + 1; 
		document.cookie = 'count=' + temp;
	}
}

