var Client = {
	Browser: {
		IE:     !!(window.attachEvent && !window.opera),
		Opera:  !!window.opera,
		Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
		DownLevelIE: window.attachEvent && !(navigator.userAgent.toLowerCase().indexOf("msie 7.")!= -1),
		Safari: navigator.userAgent.toLowerCase().indexOf("safari") != -1
	},
	OS: {
		Windows: navigator.userAgent.indexOf("Win") != -1
	}
};

	
printPage = function(){
	if(Client.Browser.IE){
		if(Client.OS.Windows) window.print();
		else alert("klicka på skrivarsymbolen i toppen av din browser");
	} else {
		window.print();
	}
}

toggleDiv = function(obj)
{
	 oDiv = document.getElementById(obj)
	 if(oDiv){
	 	if(oDiv.style.display == "block") oDiv.style.display = "none";
		else oDiv.style.display = "block";
	 }
}

var tA = new Array;
function eForm(obj,etext,num){
	if(tA[num] != undefined) {
		if(obj.value == tA[num])obj.value= "";
	} else {
		if(obj.value == etext)obj.value= "";
		tA[num] = etext
	}
}
function fForm(obj,etext,num){
	if(tA[num] != undefined) {
		if(obj.value == "")obj.value = tA[num];
	} else {
		if(obj.value == "")obj.value = etext;
	}
}	

function trapKeeDown(evt,btn){
	evt = (evt) ? evt : event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (charCode == 13){
		if (Client.Browser.Gecko) {
			evt.cancelBubble = true;
			document.getElementById(btn).focus();
		} else {
			evt.returnValue=false;
			evt.cancel = true;
			document.getElementById(btn).click();
		}
	}
}
function enterKeeDown(evt,text,page){
	evt = (evt) ? evt : event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (charCode == 13){
		if (Client.Browser.Gecko) {
			evt.preventDefault();
		} else {
			evt.returnValue=false;
			evt.cancel = true;
		}
		if(text.length > 0 && text != " ") document.location.href = "zino.aspx?pageID="+page+"&email="+text;
	}
}

	var numbers = "0123456789 ";
	function isNumber(el){
		if(numbers.indexOf(el.value.charAt(el.value.length-1)) == -1) el.value = el.value.substring(0,el.value.length-1)
	}

	
function setOption(object,index){
	if(object){
		object.options[index].selected = true;
	}
}

function initMenu(el) {
		if (Client.Browser.DownLevelIE) {
			for (i=0; i<el.childNodes.length; i++) {
				if (el.childNodes[i] && el.childNodes[i]["tagName"] && el.childNodes[i].tagName.toLowerCase() == "li") {
					el.childNodes[i].onmouseover=function() { this.className+=" over";}
  					el.childNodes[i].onmouseout=function() {this.className=this.className.replace(" over", "");}
   			}
  			}
 		}
	}

var newWindow = null;
var preHtml = "<html><head><title>S&#246;khj&#228;lp</title><style type='text/css' media='screen'> @import url(css/lmv.screen.css); </style></head>";
function createNewWin(string){
	newWindow = window.open("","",'width=350, height=400')
	if(newWindow != null){
		newWindow.document.write(preHtml + "<body id='popup'>" + string + "</body></html>");
		newWindow.document.close();
	}
}

/* zinoEdit function */
function execArgument(arg, sysID){
	if (sysID > 0)
	{ 
		switch ( arg ) {
			case "text": window['zinoWin'] = open("zino/default.aspx?pageID=11&articleID="+sysID  , "zinoWin", "width=1014,height=708,left=0,top=0,status=0,resizeable=0,scrollbars=no"); break;
			case "area": window['zinoWin'] = open("zino/default.aspx?pageID=34&areaID="+sysID  , "zinoWin", "width=1014,height=708,left=0,top=0,status=0,resizeable=0,scrollbars=no"); break;
			case "banner": window['zinoWin'] = open("zino/default.aspx?pageID=72&bannerID="+sysID  , "zinoWin", "width=1014,height=708,left=0,top=0,status=0,resizeable=0,scrollbars=no"); break;
		}
		//document.getElementById("cMenu").style.display = "none";
		if (window['zinoWin']) window['zinoWin'].focus();
	}
}

function eventCategoryRedir(value) {
	if(value != null){
		document.location = value;
	}
}

function setVoteValue(value) {
	if(value != null) {
		var container = document.getElementsByName('__VOTEVALUE')[0];
		container.value = value;
	}
}



	