
var spinner;
var bigspin;
var globalOrder;
var allowLogin = false;

               
document.observe('dom:loaded', function(){ 

	FLIR.init();
	$$("h2").each( function(el) { FLIR.replace(el, new FLIRStyle({ cFont:'interstate' }) ) } );
		
});










function doMessageUser(lang){
	allowLogin = true;
	
	if (lang == "")
	{
		lang = "se";
	}
		
	var langurl = "/cms/" + lang + "/gladsommar/";


	Modalbox.show(langurl, {title: 'VIAMETRICS', afterLoad: function(){
		Custom.init();
		FLIR.replace($('popinforub'), new FLIRStyle({ cFont:'interstate' }) );
		FLIR.replace($('update'), new FLIRStyle({ cFont:'interstatebold' }) );
		FLIR.replace($('update2'), new FLIRStyle({ cFont:'interstatebold' }) );	
	}});
}


function setCookie(id) {
	var c = new Date();
	c.setDate(c.getDate()+7);

	document.cookie = id + "=yes; expires="+c.toGMTString()+";";

}
function checkCookie(id) {
	var x = false;
	var myReg = RegExp(id+"=yes");
	var c = document.cookie.split(";");
	for(var t=0;t<c.length;t++)
	{
		
		if(c[t].match(myReg))
		{
			x = true;
			
		}
	}
	
	return x;
}

function loginnow(id) {

	
	
	if($("showthis").checked)
	{
		setCookie(id);
	}
	
	
	document.login.submit();
	
	
	
	return false;
}


function InitLoginLoad() {
	allowLogin = false;
	
	if(!checkCookie('viasommar'))
	{
		Event.observe('login','submit',function(e) {
			/*if(!allowLogin)
			{
				Event.stop(e);
				doMessageUser('se');
			}	*/
		});
	
	}	
}

Event.observe(window, 'load', InitLoginLoad, false);
