
	 var pos = 0;
	 var current_url = "";
	 var humanyTimeout;
	 var results = 0;
	 var last_ans;
	 var lastShow;

	var year = 2010;			// in what year will your target be reached?
	var month = 3;				// value between 0 and 11 (0=january,1=february,...,11=december)
	var day = 6;				// between 1 and 31
	var hour = 17;				// between 0 and 24
	var minute = 55;			// between 0 and 60
	var second = 0;			// between 0 and 60
	var eventtext = " kvar"; // text that appears next to the time left
	var endtext = "Nu är det redan igång!"; // text that appears when the target has been reached
	var end = new Date(year,month,day,hour,minute,second);
	function timeleft(){
		var now = new Date();
		if(now.getYear() < 1900)
			yr = now.getYear() + 1900;
		var sec = second - now.getSeconds();
		var min = minute - now.getMinutes();
		var hr = hour - now.getHours();
		var dy = day - now.getDate();
		var mnth = month - now.getMonth();
		var yr = year - yr;
		var daysinmnth = 32 - new Date(now.getYear(),now.getMonth(), 32).getDate();
		if(sec < 0){
			sec = (sec+60)%60;
			min--;
		}
		if(min < 0){
			min = (min+60)%60;
			hr--;	
		}
		if(hr < 0){
			hr = (hr+24)%24;
			dy--;	
		}
		if(dy < 0){
			dy = (dy+daysinmnth)%daysinmnth;
			mnth--;	
		}
		if(mnth < 0){
			mnth = (mnth+12)%12;
			yr--;
		}	
		var sectext = " sek ";
		var mintext = " min och ";
		var hrtext = " tim, ";
		var dytext = " dag, ";
		var mnthtext = " m&auml;n, ";
		var yrtext = " år, ";
		if (yr == 1)
			yrtext = " år, ";
		if (mnth == 1)
			mnthtext = " m&aring;n, ";
		if (dy == 1)
			dytext = " dag, ";
		if (hr == 1)
			hrtext = " tim, ";
		if (min == 1)
			mintext = " min och ";
		if (sec == 1)
			sectext = " sek ";
		if(now >= end){
			document.getElementById("timeleft").innerHTML = endtext;
			clearTimeout(timerID);
		}
		else{
		document.getElementById("timeleft").innerHTML = mnth + mnthtext + dy + dytext + hr + hrtext + min + mintext + sec + sectext + eventtext;
		}
		timerID = setTimeout("timeleft()", 1000); 
	}


	 function hideResult() {
		document.getElementById('humanyTop').style.display = 'none';
		document.getElementById('humanyBottom').style.display = 'none';
		document.getElementById('search-hit-info-44').style.display = 'none';
		document.getElementById('section-56').style.display = 'none';
		document.getElementById('section-57').style.display = 'none';
		document.getElementById('section-88').style.display = 'none';
		document.getElementById('search-suggest-container').style.display = 'none';
	 }
	 function showResult(typ) {
		if (typeof typ == "undefined") {
			typ = lastShow;
		}
		document.getElementById('humanyTop').style.display = 'block';
		document.getElementById('humanyBottom').style.display = 'block';
		if (typ == "all") {
			document.getElementById('section-88').className = 'section-search-hits';
			document.getElementById('search-hit-info-44').style.display = 'none';
			document.getElementById('section-56').style.display = 'block';
			document.getElementById('section-88').style.display = 'block';
			document.getElementById('section-57').style.display = 'block';
		}
		else if (typ == "both") {
			document.getElementById('search-hit-info-44').style.display = 'none';
			document.getElementById('section-88').style.display = 'none';
			document.getElementById('section-56').style.display = 'block';
			document.getElementById('section-57').style.display = 'block';
		}
		else if (typ == "faq_vod") {
			document.getElementById('section-88').className = 'section-first section-search-hits';
			document.getElementById('search-hit-info-44').style.display = 'none';
			document.getElementById('section-56').style.display = 'none';
			document.getElementById('section-88').style.display = 'block';
			document.getElementById('section-57').style.display = 'block';
		}
		else if (typ == "link_vod") {
			document.getElementById('section-88').className = 'section-search-hits';
			document.getElementById('search-hit-info-44').style.display = 'none';
			document.getElementById('section-57').style.display = 'none';
			document.getElementById('section-56').style.display = 'block';
			document.getElementById('section-88').style.display = 'block';
		}
		else if (typ == "link") {
			document.getElementById('search-hit-info-44').style.display = 'none';
			document.getElementById('section-57').style.display = 'none';
			document.getElementById('section-88').style.display = 'none';
			document.getElementById('section-56').style.display = 'block';
		}
		else if (typ == "faq") {
			document.getElementById('search-hit-info-44').style.display = 'none';
			document.getElementById('section-56').style.display = 'none';
			document.getElementById('section-88').style.display = 'none';
			document.getElementById('section-57').style.display = 'block';
		}
		else if (typ == "vod") {
			document.getElementById('section-88').className = 'section-first section-search-hits';
			document.getElementById('search-hit-info-44').style.display = 'none';
			document.getElementById('section-56').style.display = 'none';
			document.getElementById('section-57').style.display = 'none';
			document.getElementById('section-88').style.display = 'block';
		}
		if(document.getElementById('viviannQuestion').value != "") document.getElementById('search-suggest-container').style.display = 'block';
	 }
	 function showAnswer() {
		document.getElementById('section-56').style.display = 'none';
		document.getElementById('section-57').style.display = 'none';
		document.getElementById('section-88').style.display = 'none';
		document.getElementById('search-hit-info-44').style.display = 'block';
		document.getElementById('humanyTop').style.display = 'block';
		document.getElementById('humanyBottom').style.display = 'block';
		if(document.getElementById('viviannQuestion').value != "") document.getElementById('search-suggest-container').style.display = 'block';
	 }
	 function getResult() {
		 var humanyinput = document.getElementById('viviannQuestion').value;
		 if(humanyinput != "") {
			humanyinput = humanyinput.replace(/\r\n/g, "");
			var headTag = document.getElementsByTagName("head").item(0); 
			var scriptTag = document.createElement("script"); 
			scriptTag.src = "http://viasat.humany.com/search/suggest_loadb_vod.asp?entry=" + escape(humanyinput)
			headTag.appendChild(scriptTag);
		 }
		 else hideResult();
	 }
	 function humanyOpenFaq(id) {
		 humanyRegisterClick(id);
		 if (id == last_ans) {
			showAnswer();
		 }
		 else if (id != "") {
			var headTag = document.getElementsByTagName("head").item(0); 
			var scriptTag = document.createElement("script"); 
			scriptTag.src = "http://viasat.humany.com/search/suggest_loadb_vod.asp?tq_id=" + id
			headTag.appendChild(scriptTag);
		 }
	 }
	 function humanyPageL(page) {
		 var humanyinput = document.getElementById('viviannQuestion').value;
		 if(humanyinput != "") {
			 humanyinput = humanyinput.replace(/\r\n/g, "");
			 var headTag = document.getElementsByTagName("head").item(0); 
			 var scriptTag = document.createElement("script"); 
			 scriptTag.src = "http://viasat.humany.com/search/suggest_loadb_vod.asp?entry=" + escape(humanyinput) + "&pageL=" + page;
			 headTag.appendChild(scriptTag);
		 }
	}
	function humanyPageF(page) {
		 var humanyinput = document.getElementById('viviannQuestion').value;
		 if(humanyinput != "") {
			 humanyinput = humanyinput.replace(/\r\n/g, "");
			 var headTag = document.getElementsByTagName("head").item(0); 
			 var scriptTag = document.createElement("script"); 
			 scriptTag.src = "http://viasat.humany.com/search/suggest_loadb_vod.asp?entry=" + escape(humanyinput) + "&pageF=" + page;
			 headTag.appendChild(scriptTag);
		 }
	}
	function humanyPageV(page) {
		 var humanyinput = document.getElementById('viviannQuestion').value;
		 if(humanyinput != "") {
			 humanyinput = humanyinput.replace(/\r\n/g, "");
			 var headTag = document.getElementsByTagName("head").item(0); 
			 var scriptTag = document.createElement("script"); 
			 scriptTag.src = "http://viasat.humany.com/search/suggest_loadb_vod.asp?entry=" + escape(humanyinput) + "&pageV=" + page;
			 headTag.appendChild(scriptTag);
		 }
	}
	function suggest() {
		 clearTimeout(humanyTimeout);
		 
		 var humanyinput = document.getElementById('viviannQuestion').value;

		 humanyTimeout = setTimeout("getResult()",350);
		 return true;
	}
	 function humanyInit() {

		var headTag = document.getElementsByTagName("head").item(0); 
		var cssTag = document.createElement("link");
		cssTag.href = "http://viasat.humany.com/search/SearchSuggest.css";
		cssTag.rel = "stylesheet";
		cssTag.type = "text/css";
		headTag.appendChild(cssTag);

	 


		//Get position of input field
		//entryBottom = document.getElementById('viviannQuestion').offsetTop + document.getElementById('viviannQuestion').offsetHeight;
		//entryRight = (document.getElementById('viviannQuestion').offsetLeft + document.getElementById('viviannQuestion').offsetWidth;
		//entryRight = document.getElementById('viviannQuestion').offsetLeft;
		
		var suggestTag = document.createElement("div");
		suggestTag.style.position = "absolute";
		//suggestTag.style.top = entryBottom + 'px';
		//suggestTag.style.left = entryRight + 'px';
		suggestTag.style.top = '67px';
		suggestTag.style.left = '615px';

		suggestTag.id = "search-suggest-container";
		suggestTag.style.display = "none";
		suggestTag.innerHTML = "<div class=\"search-suggest\" tabindex=\"-1\"><div id=\"humanyTop\" class=\"top\" style=\"display:none\"><img src=\"http://viasat.humany.com/search/Images/clear.gif\" /></div><div class=\"center\"><div class=\"section-first section-search-hits\" id=\"section-56\"></div><div class=\"section-first section-search-hits\" id=\"section-88\"></div><div class=\"section-search-hits\" id=\"section-57\"></div><div id=\"search-hit-info-44\" class=\"section-first section-search-hit-info section-hidden\"></div></div><div id=\"humanyBottom\" class=\"bottom\" style=\"display:none\"><img src=\"http://viasat.humany.com/search/Images/clear.gif\" /></div></div>"
		//document.body.appendChild(suggestTag);
		document.getElementById('wrapper').appendChild(suggestTag);
		//alert('test4');
		document.getElementById('viviannQuestion').onkeydown=function(){
			suggest();
		}
		//alert('test5');
		//document.getElementById("startContent").wmode = "opaque";
		//alert(document.getElementById("startContent").wmode);
	 }
	 function humanyYes() {
		document.getElementById("humanyNo").checked=false;
	 }
	 function humanyNo() {
		document.getElementById("humanyYes").checked=false;
	 }
	 function humany1() {
		document.getElementById("humany2").checked=false;
		document.getElementById("humany3").checked=false;
		document.getElementById("humany4").checked=false;
		document.getElementById("humany5").checked=false;
	 }
	 function humany2() {
		document.getElementById("humany1").checked=false;
		document.getElementById("humany3").checked=false;
		document.getElementById("humany4").checked=false;
		document.getElementById("humany5").checked=false;
	 }
	 function humany3() {
		document.getElementById("humany2").checked=false;
		document.getElementById("humany1").checked=false;
		document.getElementById("humany4").checked=false;
		document.getElementById("humany5").checked=false;
	 }
	 function humany4() {
		document.getElementById("humany2").checked=false;
		document.getElementById("humany3").checked=false;
		document.getElementById("humany1").checked=false;
		document.getElementById("humany5").checked=false;
	 }
	 function humany5() {
		document.getElementById("humany2").checked=false;
		document.getElementById("humany3").checked=false;
		document.getElementById("humany4").checked=false;
		document.getElementById("humany1").checked=false;
	 }
	 function humanyLog(tq_id) {
		 if(tq_id == "") return false;
		 var headTag = document.getElementsByTagName("head").item(0); 
		 var scriptTag = document.createElement("script"); 
		 scriptTag.src = "http://viasat.humany.com/search/log.asp?tq_id=" + tq_id;
		 headTag.appendChild(scriptTag);
		 return true;
	 }
	 function humanyRegisterClick(id) {
		 if(id == "") return false;
		 var headTag = document.getElementsByTagName("head").item(0); 
		 var scriptTag = document.createElement("script"); 
		 scriptTag.src = "http://admin.humany.com/viasat_search/regClick.asp?id=" + escape(id);
		 headTag.appendChild(scriptTag);
		 return true;
	 }

	function check(e){
	//alert("check");
	var target = (e && e.target) || (event && event.srcElement);
	var obj = document.getElementById('search-suggest-container');
	var obj2 = document.getElementById('viviannQuestion');
	checkParent(target)?obj.style.display='none':null;
	if(document.getElementById('viviannQuestion').value != "") {
	target==obj2?obj.style.display='block':null;
	}
	}
	function checkParent(t){
	while(t.parentNode){
	if(t==document.getElementById('search-suggest-container')){
	return false
	}
	t=t.parentNode
	}
	return true
	}
	document.onclick=check;
	//humanyInit();

	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				oldonload();
				func();
			}
		}
	}
	addLoadEvent(humanyInit);
	//window.onload = humanyInit;


