$(document).ready(function(){ cc = $("#sinfonia-is");
	$("#topbar ul li.normal").click( function() { size = this.className.split(" "); changeSize(size[1]); return false; } );
	$("#topbar ul li a.colour").click( function() { switchStyle(this.getAttribute("rel")); $("#topbar ul li.colour").toggle(); $("#topbar ul li.default").toggle(); return false; });
	$("#topbar ul li a.default").click( function() { switchStyle(this.getAttribute("rel")); $("#topbar ul li.default").toggle(); $("#topbar ul li.colour").toggle(); return false; });
	$('#menuheader li').hover(function() { $(this).addClass('sfhover'); }, function() { $(this).removeClass('sfhover'); });
	$('#wrapper #barMenu li').hover(function() { $(this).addClass('barHover'); }, function() { $(this).removeClass('barHover'); });
	var co = $.cookie('si_style');
	if (co) switchStyle(co);
	var fz = $.cookie('si_size');
	if (fz) {cc.addClass(fz);}
	function switchStyle(styleName) { $('link[@rel*=style][@title]').each(function(i) { this.disabled = true; if (this.getAttribute('title') == styleName) this.disabled = false; }); $.cookie('si_style', styleName, {expires: 365}); }
	function changeSize(size) { csize = cc.attr("class").split(" "); 
		if (size == "zoom") {  if (csize[1] == "zoom1") {  cc.removeClass(); cc.addClass("normal zoom2"); $.cookie('si_size', 'normal zoom2', {expires: 365});
		} else { cc.addClass("zoom1"); }
		} else if(size == "small") { 
			if (csize[1] == "zoom2") { cc.removeClass(); cc.addClass("normal zoom1"); $.cookie('si_size', 'normal zoom1', {expires: 365}); 
			} else { cc.removeClass(); cc.addClass("normal"); $.cookie('si_size', 'normal', {expires: 365});
			} 
		}
	}
});
 
 function is_e_mail(the_mail) {
	if (the_mail=='') return 0;
	var i = the_mail.indexOf("@");
	if (i<1) return 0;
	var end = the_mail.substring(i+1,the_mail.length);
	if (end.length < 4) return 0;
	if (end.indexOf(".")==-1) return 0;
	return 1;
} 

function frettabref_check(adgerd) {
	if (adgerd == "skra") {
		document.list_form.action.value = "skra"
	}
	else {
		document.list_form.action.value = "afskra"
	}
	if (!is_e_mail(document.list_form.mail.value)) {
		alert('Ógilt netfang');
	}
	else
		document.list_form.submit();
}

function popup_window(s_url, s_name, s_att) {
	window.open(s_url + '&p=1', s_name, s_att)
}
