
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>');}
function KQDOM()
{}
KQDOM.removeChildren=function(obj)
{if(obj.childNodes)
{while(obj.childNodes.length>0)
{obj.removeChild(obj.childNodes[0]);}}}
KQDOM.searchParentByTag=function(obj,tag)
{var parentNode=obj;var found=false;var node=null;do
{if(parentNode.tagName.toLowerCase()==tag.toLowerCase())
{found=true;node=parentNode;}}
while(!found&&(parentNode=parentNode.parentNode))
return node;}
KQDOM.searchParentByClassName=function(obj,className)
{var parentNode=obj;var found=false;var node=null;do
{if(parentNode.className==className)
{found=true;node=parentNode;}}
while(!found&&(parentNode=parentNode.parentNode))
return node;}
KQDOM.getWindowHeight=function()
{if(typeof(window.innerWidth)=='number')
{return window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
{return document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
{return document.body.clientHeight;}}
KQDOM.getWindowWidth=function()
{if(typeof(window.innerWidth)=='number')
{return window.innerWidth;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
{return document.documentElement.clientWidth;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
{return document.body.clientWidth;}}
KQDOM.getDocumentHeight=function()
{return document.body.offsetHeight;}
KQDOM.getDocumentWidth=function()
{return document.body.offsetWidth;}
KQDOM.getWindowCenterWidth=function(offset)
{return(KQDOM.getWindowWidth()/2)-offset;}
KQDOM.getWindowCenterHeight=function(offset)
{return(KQDOM.getWindowHeight()/2)-offset;}
KQDOM.getScrollX=function()
{if(typeof(window.pageYOffset)=='number')
{return window.pageXOffset;}
else if(document.body&&(document.body.scrollLeft||document.body.scrollTop))
{return document.body.scrollLeft;}
else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop))
{return document.documentElement.scrollLeft;}}
KQDOM.getScrollY=function()
{if(typeof(window.pageYOffset)=='number')
{return window.pageYOffset;}
else if(document.body&&(document.body.scrollLeft||document.body.scrollTop))
{return document.body.scrollTop;}
else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop))
{return document.documentElement.scrollTop;}}
function KQEvent()
{}
KQEvent.addEvent=function(elm,evType,fn,useCapture)
{if(elm.addEventListner)
{elm.addEventListner(evType,fn,useCapture);return true;}
else if(elm.attachEvent)
{var r=elm.attachEvent('on'+evType,fn);return r;}
else
elm['on'+evType]=fn;}
KQEvent.removeEvent=function(elm,evType,fn)
{if(elm.detachEvent)
{elm.detachEvent('on'+evType,elm[evType+fn]);elm[evType+fn]=null;}
else
elm.removeEventListener(evType,fn,false);}
KQEvent.checkEvent=function(e)
{if(typeof e=='undefined')
return window.event;else
return e;}
KQEvent.getEventTarget=function(e)
{return window.event?window.event.srcElement:e?e.target:null;}
var KQForm={getExecutorSubmit:function(button,c,m)
{var form=KQDOM.searchParentByTag(button,'form');var inputs=form.getElementsByTagName('INPUT');var selects=form.getElementsByTagName('SELECT');var textareas=form.getElementsByTagName('TEXTAREA');var executor=new sack();executor.requestFile='/index.php';executor.setVar('c_',c);executor.setVar('m_',m);for(var no=0;no<inputs.length;no++)
{switch(inputs[no].type)
{case'checkbox':case'radio':if(inputs[no].checked)
executor.encVar(inputs[no].name,inputs[no].value,false);break;default:executor.encVar(inputs[no].name,inputs[no].value,false);}}
for(var no=0;no<selects.length;no++)
{executor.encVar(selects[no].name,selects[no].value,false);}
for(var no=0;no<textareas.length;no++)
{executor.encVar(textareas[no].name,textareas[no].value,false);}
return executor;executor.onCompletion=function(){writeStatus('Skjema ferdig postet',true);eval(executor.response);};executor.runAJAX();},submitForm:function(button,c,m)
{var form=KQDOM.searchParentByTag(button,'form');var inputs=form.getElementsByTagName('INPUT');var selects=form.getElementsByTagName('SELECT');var textareas=form.getElementsByTagName('TEXTAREA');var executor=new sack();executor.requestFile='/index.php';executor.setVar('c_',c);executor.setVar('m_',m);for(var no=0;no<inputs.length;no++)
{switch(inputs[no].type)
{case'checkbox':case'radio':if(inputs[no].checked)
executor.encVar(inputs[no].name,inputs[no].value,false);break;default:executor.encVar(inputs[no].name,inputs[no].value,false);}}
for(var no=0;no<selects.length;no++)
{executor.encVar(selects[no].name,selects[no].value,false);}
for(var no=0;no<textareas.length;no++)
{executor.encVar(textareas[no].name,textareas[no].value,false);}
executor.onCompletion=function(){writeStatus('Skjema ferdig postet',true);eval(executor.response);};executor.runAJAX();},submitFormAndLoadContent:function(formId,c,m)
{writeStatus('Poster skjema');var form=document.getElementById(formId);var inputs=form.getElementsByTagName('INPUT');var selects=form.getElementsByTagName('SELECT');var textareas=form.getElementsByTagName('TEXTAREA');var executor=new sack();executor.requestFile='/index.php';executor.setVar('c_',c);executor.setVar('m_',m);for(var no=0;no<inputs.length;no++)
{executor.encVar(inputs[no].name,inputs[no].value);}
for(var no=0;no<selects.length;no++)
{executor.encVar(selects[no].name,selects[no].value);}
for(var no=0;no<textareas.length;no++)
{executor.encVar(textareas[no].name,textareas[no].value);}
executor.onCompletion=function(){writeStatus('Skjema ferdig postet');mainContent.innerHTML=executor.response;executeScript(mainContent);loadingBar.innerHTML=''};executor.runAJAX();}}
function sack(file){this.xmlhttp=null;this.resetData=function(){this.method="POST";this.queryStringSeparator="?";this.argumentSeparator="&";this.URLString="";this.encodeURIString=true;this.execute=false;this.element=null;this.elementObj=null;this.requestFile=file;this.vars=new Object();this.responseStatus=new Array(2);};this.resetFunctions=function(){this.onLoading=function(){};this.onLoaded=function(){};this.onInteractive=function(){};this.onCompletion=function(){};this.onError=function(){};this.onFail=function(){};};this.reset=function(){this.resetFunctions();this.resetData();};this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e1){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){this.xmlhttp=null;}}
if(!this.xmlhttp){if(typeof XMLHttpRequest!="undefined"){this.xmlhttp=new XMLHttpRequest();}else{this.failed=true;}}};this.setVar=function(name,value){this.vars[name]=Array(value,false);};this.encVar=function(name,value,returnvars){if(true==returnvars){return Array(encodeURIComponent(name),encodeURIComponent(value));}else{this.vars[encodeURIComponent(name)]=Array(encodeURIComponent(value),true);}}
this.processURLString=function(string,encode){encoded=encodeURIComponent(this.argumentSeparator);regexp=new RegExp(this.argumentSeparator+"|"+encoded);varArray=string.split(regexp);for(i=0;i<varArray.length;i++){urlVars=varArray[i].split("=");if(true==encode){this.encVar(urlVars[0],urlVars[1]);}else{this.setVar(urlVars[0],urlVars[1]);}}}
this.createURLString=function(urlstring){if(this.encodeURIString&&this.URLString.length){this.processURLString(this.URLString,true);}
if(urlstring){if(this.URLString.length){this.URLString+=this.argumentSeparator+urlstring;}else{this.URLString=urlstring;}}
this.setVar("rndval",new Date().getTime());urlstringtemp=new Array();for(key in this.vars){if(false==this.vars[key][1]&&true==this.encodeURIString){encoded=this.encVar(key,this.vars[key][0],true);delete this.vars[key];this.vars[encoded[0]]=Array(encoded[1],true);key=encoded[0];}
urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0];}
if(urlstring){this.URLString+=this.argumentSeparator+urlstringtemp.join(this.argumentSeparator);}else{this.URLString+=urlstringtemp.join(this.argumentSeparator);}}
this.runResponse=function(){eval(this.response);}
this.runAJAX=function(urlstring){if(this.failed){this.onFail();}else{this.createURLString(urlstring);if(this.element){this.elementObj=document.getElementById(this.element);}
if(this.xmlhttp){var self=this;if(this.method=="GET"){totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;this.xmlhttp.open(this.method,totalurlstring,true);}else{this.xmlhttp.open(this.method,this.requestFile,true);try{this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(e){}}
this.xmlhttp.onreadystatechange=function(){switch(self.xmlhttp.readyState){case 1:self.onLoading();break;case 2:self.onLoaded();break;case 3:self.onInteractive();break;case 4:self.response=self.xmlhttp.responseText;self.responseXML=self.xmlhttp.responseXML;self.responseStatus[0]=self.xmlhttp.status;self.responseStatus[1]=self.xmlhttp.statusText;if(self.execute){self.runResponse();}
if(self.elementObj){elemNodeName=self.elementObj.nodeName;elemNodeName.toLowerCase();if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){self.elementObj.value=self.response;}else{self.elementObj.innerHTML=self.response;}}
if(self.responseStatus[0]=="200"){self.onCompletion();}else{self.onError();}
self.URLString="";break;}};this.xmlhttp.send(this.URLString);}}};this.reset();this.createAJAX();}
(function(){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={array:function(x){var a=['['],b,f,i,l=x.length,v;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}
a[a.length]=v;b=true;}}}
a[a.length]=']';return a.join('');},'boolean':function(x){return String(x);},'null':function(x){return"null";},number:function(x){return isFinite(x)?String(x):'null';},object:function(x){if(x){if(x instanceof Array){return s.array(x);}
var a=['{'],b,f,i,v;for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}
a.push(s.string(i),':',v);b=true;}}}
a[a.length]='}';return a.join('');}
return'null';},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}
c=b.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);});}
return'"'+x+'"';}};Object.prototype.toJSONString=function(){return s.object(this);};Array.prototype.toJSONString=function(){return s.array(this);};})();String.prototype.parseJSON=function(){try{return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(this.replace(/"(\\.|[^"\\])*"/g,'')))&&eval('('+this+')');}catch(e){return false;}};function $(id)
{return document.getElementById(id);}
var Statuett={init:function()
{if($('statuettselect'))
{var self=this;self.changeProd();var line1=document.getElementsByName('productinput[59]');var line2=document.getElementsByName('productinput[60]');var line3=document.getElementsByName('productinput[61]');KQEvent.addEvent(line1[0],'keyup',self.calculateSum,false);KQEvent.addEvent(line2[0],'keyup',self.calculateSum,false);KQEvent.addEvent(line3[0],'keyup',self.calculateSum,false);KQEvent.addEvent($('statuettselect'),'change',self.changeProd,false);}},changeProd:function()
{var executor=new sack('index.php?c_=MusetteCart&m_=getProductModel');executor.encVar('MSprodid',$('statuettselect').value);executor.onCompletion=function()
{Statuett.changeProdInfo(executor.response);};executor.runAJAX();},changeProdInfo:function(response)
{var myarray=null;myarray=response.parseJSON();if(myarray)
{$('prodstatmodellpricePris').innerHTML=myarray.cost;if(myarray.closepicurl!='')
$('prodstatmodellpic').innerHTML='<img src="'+myarray.closepicurl+'" alt="" />';else
$('prodstatmodellpic').innerHTML='';}
this.calculateSum();},calculateSum:function()
{var myarray=null;var executor=new sack('index.php?c_=MusetteCart&m_=calculateSum');executor.encVar('MSprodid',$('statuettselect').value);executor.encVar('Statuettprodid',$('Statuettprodid').value);var attr=document.getElementsByName('productinput[59]');executor.encVar('productinput59',attr[0].value);var attr=document.getElementsByName('productinput[60]');executor.encVar('productinput60',attr[0].value);var attr=document.getElementsByName('productinput[61]');executor.encVar('productinput61',attr[0].value);executor.onCompletion=function()
{myarray=executor.response.parseJSON();$('totalprice').innerHTML=myarray.totalprice;$('numberletters').innerHTML=myarray.linelength;$('priceletters').innerHTML=myarray.lineprice;$('letterprice').innerHTML=myarray.letterprice;};executor.runAJAX();}}
