
function KEYPUBLISHER_Adminbar_getWidth()
{if(document.documentElement.clientWidth==0)
return document.body.clientWidth+"px";else
return document.documentElement.clientWidth+"px";}
var locationbar='no';var ref=0;function setref(s){ref=s;}
var MSIE=(navigator.userAgent.indexOf('MSIE')>=0&&navigator.userAgent.indexOf('Win')>=0&&navigator.userAgent.toLowerCase().indexOf('opera')<0)?true:false;var Opera=opera=navigator.userAgent.toLowerCase().indexOf('opera')>=0?true:false;var navigatorVersion=navigator.appVersion.replace(/.*?MSIE (\d\.\d).*/g,'$1')/1;function rand(){return new String(Math.ceil(Math.random()*200+1));}
function popuperror(){alert("     Du må skru på Javaskript \"Popup\" støtte i nettleseren din"+"\n\n"+"___________________________________________________________"+"\n\n"+"             Informasjon om dette, kan du finne på:"+"\n\n"+"                       www.keyteq.no/kundesenter/popup               "+"\n\n"+"\n\n"+"____________________________________________________________");}
function getY(height){return(screen.height-height)/2;}
function getX(width){return(screen.width-width)/2;}
function openKeyPublisherWindow(url,name,height,width,scroll,toolbar,resize)
{if(scroll)scroll='yes';else scroll='no';if(toolbar)toolbar='yes';else toolbar='no';if(resize)resize='yes';else resize='no';var newwindow=window.open(url,name,'height='+height+', width='+width+', status=no, scrollbars='+scroll+', toolbar='+toolbar+', resizable='+resize+', location='+locationbar+', menubar=no,top='+getY(height)+', left='+getX(width),'true');if(!newwindow){popuperror();}else{if(!newwindow.opener){newwindow.opener=self;}if(window.focus){newwindow.focus();}}}
function customWindow(path,windowname,height,width){openKeyPublisherWindow(path,windowname+ref,height,width,false,false,true);}
function productPopup(popupId,productId,height,width,scrollable,resizeable){openKeyPublisherWindow('/index.php?c_=ShopProductPopupGUI&m_=showPopup&popupId='+popupId+'&productId='+productId,'productPopup'+ref,height,width,scrollable,false,resizeable);}
function customWindowToolbar(path,windowname,height,width){openKeyPublisherWindow(path,windowname+ref,height,width,true,true,true);}
function customWindowResize(path,windowname,height,width){openKeyPublisherWindow(path,windowname+ref,height,width,true,false,true);}
function customWindowScroll(path,windowname,height,width){openKeyPublisherWindow(path,windowname+ref,height,width,true,false,true);}
function getnavipos(){if(typeof window.pageYOffset!='undefined')return pos=window.pageYOffset;else return pos=Math.max(document.body.scrollTop,document.documentElement.scrollTop);}
function phonelistcard(phonelistid){customWindow('/index.php?c_=PhonelistGUI&m_=writeCard&PhonelistGUI_writeCard_0_='+phonelistid,'writecard',200,300);}
function checkUser(){return;script=document.createElement('script');script.setAttribute('src','/checkuser.php');script.setAttribute('language','Javascript');script.setAttribute('type','text/javascript');document.getElementsByTagName('head').item(0).appendChild(script);setTimeout("checkUser()",5000);}
function helpWindow(extraUrl){if(!window.open('http://keypublisher.manual.keyteq.no'+extraUrl,'help','height=500, width=900, scrollbars=yes, status=no, toolbar=no, resizable=yes, location='+locationbar+', menubar=no,top=70, left=20','true'))popuperror();}
function runGraph(chart,xml,width,height,http)
{document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+http+'://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'" ALIGN=""  id="charts">');document.write('<PARAM NAME=movie VALUE="/executable/fusion_charts/'+chart+'">');document.write('<PARAM NAME="FlashVars" VALUE="&dataXML='+xml+'&chartWidth='+width+'&chartHeight='+height+'">');document.write('<PARAM NAME="quality" VALUE="high">');document.write('<PARAM NAME="bgcolor" VALUE="#FAFAFA">');document.write('<PARAM NAME="wmode" VALUE="transparent">');document.write('<EMBED src="/executable/fusion_charts/'+chart+'" FlashVars="&dataXML='+xml+'&chartWidth='+width+'&chartHeight='+height+'" quality="high" bgcolor=#FAFAFA" wmode="transparent"  WIDTH="'+width+'" HEIGHT="'+height+'" NAME="charts" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="'+http+'://www.macromedia.com/go/getflashplayer"></EMBED>');document.write('</OBJECT>');}
var gTabMenu=function(start,count,eId)
{for(i=start;i<count+start;i++)
{params='gTab'+i;if(params==eId)continue;document.getElementById(params).className="ikkeAktiv gTab";params='content_'+'gTab'+i;document.getElementById(params).style.display="none";}
document.getElementById(eId).className="aktiv gTab";params='content_'+eId;document.getElementById(params).style.display="block";}
var tabMeny=function(tabID)
{var aktivTab=tabID;switch(aktivTab)
{case"tab1":document.getElementById('tab1').className="aktiv";document.getElementById('tab2').className="ikkeAktiv";document.getElementById('tab3').className="ikkeAktiv";document.getElementById('content_tab1').style.display="block";document.getElementById('content_tab2').style.display="none";document.getElementById('content_tab3').style.display="none";break;case"tab2":document.getElementById('tab1').className="ikkeAktiv";document.getElementById('tab2').className="aktiv";document.getElementById('tab3').className="ikkeAktiv";document.getElementById('content_tab1').style.display="none";document.getElementById('content_tab2').style.display="block";document.getElementById('content_tab3').style.display="none";break;case"tab3":document.getElementById('tab1').className="ikkeAktiv";document.getElementById('tab2').className="ikkeAktiv";document.getElementById('tab3').className="aktiv";document.getElementById('content_tab1').style.display="none";document.getElementById('content_tab2').style.display="none";document.getElementById('content_tab3').style.display="block";break;default:document.getElementById('tab1').className="aktiv";document.getElementById('tab2').className="ikkeAktiv";document.getElementById('tab3').className="ikkeAktiv";document.getElementById('content_tab1').style.display="block";document.getElementById('content_tab2').style.display="none";document.getElementById('content_tab3').style.display="none";}}
function GLAVA_SearchResultNavigator()
{}
GLAVA_SearchResultNavigator.prototype={moreElements:5,setStats:function(element,text)
{$(element).find('.stats').html(text);},calcListElements:function(element)
{return $(element).find('.allResults').children('.result').size();},calcVisibleListElements:function(element)
{return $(element).find('.allResults').children('.result:visible').size();},calcHiddenListElements:function(element)
{return this.calcListElements(element)-this.calcVisibleListElements(element);},getListElements:function(element)
{return $(element).find('.allResults').children('.result');},getHiddenElements:function(element)
{return $(element).find('.allResults').children('.result:hidden');},getVisibleElements:function(element)
{return $(element).find('.allResults').children('.result:visible');},openCloseResult:function(element)
{if(this.calcVisibleListElements(element)>0)
{var ve=this.getVisibleElements(element);var size=ve.size();for(var i=0;i<size;i++)
{var $e=$(ve.get(i));var $prev=$e.prev();if($prev.hasClass('documentType'))
$prev.hide();$e.hide();}
$(element).find('.openClose').removeClass('close');$(element).find('.openClose').addClass('open');$(element).find('.resultsTop').hide();$(element).find('.allResults').hide();$(element).find('.resultsBottom').hide();}
else
{var ve=this.getListElements(element);var size=ve.size();for(var i=0;i<size;i++)
{var $e=$(ve.get(i));var $prev=$e.prev();if(i<this.moreElements)
{if($prev.hasClass('documentType'))
$prev.show();$e.show();}
else
{if($prev.hasClass('documentType'))
$prev.hide();$e.hide();}}
$(element).find('.openClose').removeClass('open');$(element).find('.openClose').addClass('close');$(element).find('.resultsTop').show();$(element).find('.allResults').show();$(element).find('.resultsBottom').show();}
this.setStats(element,'Viser '+this.calcVisibleListElements(element)+' av '+this.calcListElements(element)+' treff');if(this.calcHiddenListElements(element)>0)
{$(element).find('.options').find('a').html('Vis flere resultater ('+this.calcHiddenListElements(element)+')');$(element).find('.options').find('a').show();}
else
{$(element).find('.options').find('a').hide();$(element).find('.options').find('a').html('');}},moreLessResult:function(element){if(this.calcHiddenListElements(element)>0)
{var he=this.getHiddenElements(element);for(var i=0;i<he.size()&&i<this.moreElements;i++)
{$e=$(he.get(i));$prev=$e.prev();if($prev.hasClass('documentType'))
$prev.show();$e.show();}
if(this.calcHiddenListElements(element)>0)
{$(element).find('.options').find('a').html('Vis flere resultater ('+this.calcHiddenListElements(element)+')');$(element).find('.options').find('a').show();}
else
{$(element).find('.options').find('a').hide();$(element).find('.options').find('a').html('');}
$(element).find('.resultsTop').show();$(element).find('.allResults').show();$(element).find('.resultsBottom').show();}
this.setStats(element,'Viser '+this.calcVisibleListElements(element)+' av '+this.calcListElements(element)+' treff');},setTopSearchCheckboxHandling:function()
{$('.selectAllTabCheckboxes').each(function(index,element)
{$(element).click(function(ev)
{$(this).parent().find('ul').find('input[type=checkbox]').each(function(i,e)
{$(e).attr('checked',true);});});})
$('.deselectTabCheckboxes').each(function(index,element)
{$(element).click(function(ev)
{$(this).parent().find('ul').find('input[type=checkbox]').each(function(i,e)
{$(e).attr('checked',false);});});})},setPageSearchNavigationOptionsHandling:function()
{$('.selectCheckboxes').each(function(index,element)
{$(element).click(function(ev)
{$(this).parent().parent().find('.selectBoxHolder').find('input[type=checkbox]').each(function(i,e)
{$(e).attr('checked',true);});});})
$('.deselectCheckboxes').each(function(index,element)
{$(element).click(function(ev)
{$(this).parent().parent().find('.selectBoxHolder').find('input[type=checkbox]').each(function(i,e)
{$(e).attr('checked',false);});});})
$('#hideBtn').click(function(ev)
{ev.stopPropagation();if($('.advancedSearch').is(':visible'))
{$('#hideBtn').css('background-position','0px -103px');$('.advancedSearch').hide();}
else
{$('#hideBtn').css('background-position','0px 0px');$('.advancedSearch').show();}
return false;});$('.globalSearchResults').find('.searchCategoryHeader').find('a:first').each(function(index,element)
{$(element).click(function(ev)
{ev.stopPropagation();var gsrn=new GLAVA_SearchResultNavigator();gsrn.openCloseResult($(ev.target).parent().parent().parent().get(0));return false;});});$('.globalSearchResults').find('.options').each(function(index,element)
{$(element).click(function(ev)
{ev.stopPropagation();var gsrn=new GLAVA_SearchResultNavigator();gsrn.moreLessResult($(ev.target).closest('.globalSearchResults').get(0));return false;});});}}
$(document).ready(function()
{var gsrn=new GLAVA_SearchResultNavigator();gsrn.setTopSearchCheckboxHandling();gsrn.setPageSearchNavigationOptionsHandling();})
function newsletterHandler()
{$('.newsletterContent').get(0).reset();$('.newsletterContent').find('.message').html('');$('.newsletterContent').find('.message').removeClass('ok');$('.newsletterContent').find('.message').removeClass('error');$('.newsletterContent').find('.sendBtn').click(function(ev)
{ev.preventDefault();ev.stopPropagation();$('.newsletterContent').find('.message').html('');$('.newsletterContent').find('.message').removeClass('ok');$('.newsletterContent').find('.message').removeClass('error');$.ajax({url:'/index.php',data:$('.newsletterContent').serialize(),type:'POST',success:function(data,textStatus,jqXHR)
{if(data=='Ok')
{$('.newsletterContent').find('.message').html('Du er nå påmeldt vårt nyhetsbrev!');$('.newsletterContent').find('.message').addClass('ok');}
else
{$('.newsletterContent').find('.message').html(data);$('.newsletterContent').find('.message').addClass('error');}},error:function()
{$('.newsletterContent').find('.message').html('Feil ved påmelding til nyhetsbrev!');$('.newsletterContent').find('.message').addClass('error');}});});}
newsletterHandler.prototype={}
$(document).ready(function()
{if($('.newsletterlink').size()==0)
return;$('.newsletterlink').fancybox({'scrolling':'no','titleShow':false,'content':$('.newsletterContent'),'onClosed':function()
{}});$('.newsletterlink').click(function(ev)
{ev.preventDefault();ev.stopPropagation();new newsletterHandler();});});
