// toggle
function notice_toggle() {
	for (var i=0, el; el = document.getElementById(arguments[i]); i++) {
		el.style.display = (el.style.display != 'none' ? 'none' : '' );
	}
}
function tab_createCookie(name, value, days, host) {
	var date, expires;
	if (days) {
		date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	else {
		expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/; domain=."+host;
}
function tab_readCookie(name) {
	var nameEQ = name+"=",
	ca = document.cookie.split(';'),
	i, c;

	for(i = 0; i < ca.length; i++) {
		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 exitSite(currentSite,newSite,newURL,hostName) {
	var seenTabNotice = tab_readCookie('seenTabNotice_'+currentSite);
	if(seenTabNotice != '1') {
		// show tab notice and create cookie
		tab_createCookie('seenTabNotice_'+currentSite,'1',365, hostName);
		notice_toggle(currentSite+newSite+'_notice');
	}
	else {
		// go to site
		window.location.href = newURL;
	}
}

/* minified
function notice_toggle(){for(var i=0,el;el=document.getElementById(arguments[i]);i++){el.style.display=(el.style.display!='none'?'none':'');}}
function tab_createCookie(name,value,days,host){var date,expires;if(days){date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}else{expires="";}document.cookie=name+"="+value+expires+"; path=/; domain=."+host;}
function tab_readCookie(name){var nameEQ=name+"=",ca=document.cookie.split(';'),i,c;for(i=0;i<ca.length;i++){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 exitSite(currentSite,newSite,newURL,hostName){var seenTabNotice=tab_readCookie('seenTabNotice_'+currentSite);if(seenTabNotice!='1'){tab_createCookie('seenTabNotice_'+currentSite,'1',365,hostName);notice_toggle(currentSite+newSite+'_notice');}else{window.location.href=newURL;}}
*/
