function getById(element) {
	return document.getElementById(element);
}
function byturl(url){
	window.location = url ;
}
function popup(win) {
	bakom = window.open(win,'bakom','height=350,width=500,status=no,toolbar=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}
function popuptrailer(win) {
	bakom = window.open(win,'bakom','height=510,width=535,status=no,toolbar=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}
function popupjuice(win) {
	bakom = window.open(win,'bakom','height=510,width=625,status=no,toolbar=no,directories=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}
function apegroup_popup(theURL) {
	window.open(theURL,'Trailers','toolbar=no,location=no,directories=no,status=no,menubar=no,titlebar=yes, scrollbars=no,resizable=no,width=1010,height=746,top=100,left=100,fullscreen=no');
}
function apegroup_psp_popup(theURL) {
	window.open(theURL,'Trailers','toolbar=no,location=no,directories=no,status=no,menubar=no,titlebar=yes, scrollbars=no,resizable=no,width=600,height=440,top=310,left=400,fullscreen=no');
}
function toggelContent(iObject) {
	if(getById(iObject)) {
		getById(iObject).style.display = (getById(iObject).style.display == "none" ? "block" : "none");
	}
}
function toggleSpec() {
	toggelContent("specifikationer");
	toggelContent("specifikationer_text");
	toggelContent("specifikationer_text_extra");
	toggelContent("specifikationer_visa");
	toggelContent("specifikationer_dolj");
	toggelContent("specifikationer_sprak_basta");
	toggelContent("specifikationer_sprak_alla");
	toggelContent("specifikationer_utokade_1");
	toggelContent("specifikationer_utokade_3");
	toggelContent("specifikationer_box");
	toggelContent("specifikationer_alias");
}
function toggleOmdome(omdome_nr) {
	omdome = getById('omdome_' + omdome_nr).style;
	omdome.display = (omdome.display == "none" ? "block" : "none") ;
}
function toggleBeskrivning() {
	getById('beskrivningforts').style.display = "block" ;
	getById('beskrivninglank').style.display = "none" ;
}
function togglePlus() {
	
	pluson_1 = getById("pluson");
	plusoff_1 = getById("plusoff");
	pluscontenton_1 = getById("pluscontenton");
	plusheader_1 = getById("plusheader");
	plustextoff_1 = getById("plustextoff");
	plustexton_1 = getById("plustexton");
	
	pluson_1.style.display = (pluson_1.style.display == "none" ? "block" : "none");
	plusoff_1.style.display = (plusoff_1.style.display == "none" ? "block" : "none");
	pluscontenton_1.style.display = (pluson_1.style.display == "none" ? "none" : "block");
	plusheader_1.style.backgroundImage = (pluson_1.style.display == "none" ? "url('img/design/v5/ds_list_bg.jpg')" : "url('img/design/v5/ds_payment_bg.jpg')");
	
	plustextoff_1.style.display = (pluson_1.style.display == "none" ? "block" : "none");
	plustexton_1.style.display = (plusoff_1.style.display == "none" ? "block" : "none");
	
	var saveURL = 'include/meny_savesettings.inc.php?menu=pluson&display=' + pluson_1.style.display;
	var cont = getById('settingSavePlusContainer');
	
	var imgSaveElement = document.createElement("IMG");
	imgSaveElement.style.width = '1px';
	imgSaveElement.style.height = '1px';
	imgSaveElement.style.border = '0px';
	imgSaveElement.src = saveURL;
	imgSaveElement.id = 'saveImgpluson';
	cont.appendChild(imgSaveElement);
}
function toggleSearchFilter() {
	
	sfilteron_1 = getById("sfilteron");
	sfilteroff_1 = getById("sfilteroff");
	sfiltercontenton_1 = getById("sfiltercontenton");
	sfilterheader_1 = getById("sfilterheader");
	sfiltertextoff_1 = getById("sfiltertextoff");
	sfiltertexton_1 = getById("sfiltertexton");
	
	sfilteron_1.style.display = (sfilteron_1.style.display == "none" ? "block" : "none");
	sfilteroff_1.style.display = (sfilteroff_1.style.display == "none" ? "block" : "none");
	sfiltercontenton_1.style.display = (sfilteron_1.style.display == "none" ? "none" : "block");
	sfilterheader_1.style.backgroundImage = (sfilteron_1.style.display == "none" ? "url('img/design/v5/ds_list_bg.jpg')" : "url('img/design/v5/ds_payment_bg.jpg')");
	
	sfiltertextoff_1.style.display = (sfilteron_1.style.display == "none" ? "block" : "none");
	sfiltertexton_1.style.display = (sfilteroff_1.style.display == "none" ? "block" : "none");
}
function toggleMenu( identifier ) {
    menuObj = document.getElementById( identifier );
    menuArrow = document.getElementById( identifier + 'Top' );
	menuObj.style.display = (menuObj.style.display == "none" ? "block" : "none");
    menuArrow.className = (menuObj.style.display == "none" ? 'left_menu' : 'left_menu left_menu_sel'); 
    var saveURL = 'include/meny_savesettings.inc.php?menu=' + identifier + '&display=' + menuObj.style.display;
    var cont = document.getElementById('settingSaveContainer');
    var imgSaveElement = document.createElement("IMG");
    imgSaveElement.style.width = '1px';
    imgSaveElement.style.height = '1px';
    imgSaveElement.style.border = '0px';
    imgSaveElement.src = saveURL;
    imgSaveElement.id = 'saveImg' + identifier;
    cont.appendChild(imgSaveElement);
}

function disableSelection(target){
	if (typeof target.onselectstart!="undefined") //IE route
		target.onselectstart=function(){return false}
	else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
		target.style.MozUserSelect="none"
	else //All other route (ie: Opera)
		target.onmousedown=function(){return false}
	target.style.cursor = "default"
}
function toggleMenuCheck(identifier) {
	menuObj = document.getElementById( identifier );
	menuArrow = document.getElementById( identifier + 'Image' );
	menuObj.style.display = (menuObj.style.display == "none" ? "block" : "none");
	if ( menuObj.style.display == "none" ) { toggleMenu(identifier) }
}
function hideHelpMessage() {
	if(getById('msg_help')){ 
		setTimeout('Spry.Effect.DoFade(\'msg_help\', {duration: 1000, from: 100, to: 0, toggle: false})', 3000);
		setTimeout('getById(\'msg_help\').style.display=\'none\';', 4000);
	}
}
function Client() {
  var ua, s, i;

  this.isIE = false;  // Internet Explorer
  this.isNS = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.
  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var client = new Client();

function bExclude(obj) {
 var children = obj.parentNode.childNodes;
  var cat = children[1];
  var i = 1;
  /** firefox 8.0 compatibility */
  if(client.isNS){
     while( (!cat.tagName || cat.tagName!="A" || cat.firstChild.tagName=="IMG") && i<children.length){
      i++;
      cat = children[i];
    }      
  }
  cat.style.textDecoration = 'line-through';
}

function bUnExclude(obj) {
  var children = obj.parentNode.childNodes;
  var cat = children[1];
  var i = 1;
  /** firefox 8.0 compatibility */
   if(client.isNS){
    while( (!cat.tagName || cat.tagName!="A" || cat.firstChild.tagName=="IMG") && i<children.length){
      i++;
      cat = children[i];
    }      
  }
  cat.style.textDecoration = 'none';
}
	
function refineResults(xValue){
	if(xValue.substring(0,3)=="_c="){
		document.exalead._c.value= xValue.substr(3);
	}else if(xValue.substring(0,3)=="_z="){
		document.exalead._z.value=xValue.substr(3);
	}else if(xValue.substring(0,3)=="_s="){
		document.exalead._s.value=xValue.substr(3);
	}
	document.exalead._sf.value='-prog';
	document.exalead.submit();
}

function submitXSearch(c){
	document.exalead._c.value='';
	document.exalead._z.value='';
	document.exalead._s.value='';
	document.exalead._sf.value='';
	document.exalead._C.value='';
	document.exalead.__movieCount.value='';
	document.exalead.__gameCount.value='';
	document.exalead.__musicdvdCount.value='';
	document.exalead.aHit.value='';
	document.exalead.submit();
}
	
function changeTab(cat,q){
	if(cat=="more"){
		document.exalead.nosearch_page.value='more';
	} else if(cat=="help"){
		document.exalead.nosearch_page.value='help';
	}else{
		document.exalead.__cat.value=cat;
	}
	document.exalead._c.value='';
	document.exalead._z.value='';
	document.exalead._s.value='';
	document.exalead._sf.value='';
	document.exalead._C.value='';
	
	document.exalead._q.value=q;
	document.exalead.submit();
}

var auto_complete_search = null;

function autoComplete(object, value, subsite) {
	clearTimeout(auto_complete_search);
	auto_complete_search = setTimeout('xajax_be_title_auto_complete(\''+object+'\',\''+value+'\',\''+subsite+'\');',500);
}

var auto_complete_contact_us_faq = null;

function autoCompleteContactUsFAQ(value) {
	value = escape(value);
	clearTimeout(auto_complete_contact_us_faq);
	auto_complete_contact_us_faq = setTimeout('xajax_customer_help_contact_faq_check(\''+value+'\')',1000);
}

/* Add initial javascript-functions */
be_init = function() {
	addReflections();
	hideHelpMessage();
}
window.onload = be_init;