
var isval = 0;
var oplast = 0;
var val1 = 0;
var val2 = "";
var val3 = "";
var op1 = "";
var op2 = "";
var op3 = "";
var ChangeVar = "";

function digit(d) {
  if (isval) {
    if (document.calculator.display.value == "0")
      document.calculator.display.value = d;
    else
      document.calculator.display.value += d;
  }
  else {
    document.calculator.display.value = d;
    isval = 1;
  }
  oplast = 0;
}


function decimal() {
  if (document.calculator.display.value == "0" || !isval)	
    document.calculator.display.value = "0,";
  else if (document.calculator.display.value.indexOf(',') != -1)   
    return;
  else   
    document.calculator.display.value += ',';

  isval = 1;
  oplast = 0;
}

function binary(op) {
  if (oplast) {
    op1 = op + " ";
    return;
  }
  
  changeFormat2(1,document.calculator.display.value)			
  var temp = "" + ChangeVar; 

  if (op == '+' || op == '-') {
    if (op1) {
      if (op1 == "p")
        temp = Math.pow(val1, temp);
      else
        temp = eval(val1 + op1 + temp);

      if (op2) {
        temp = eval(val2 + op2 + temp);
        val2 = "";
        op2 = "";

        if (op3) {
          temp = eval(val3 + op3 + temp);
          val3 = "";
          op3 = "";
        }
      }
    }
  }

  else { /* x or / */
    if (op1) {
      if (op1 == "+ " || op1 == "- ") {
        val2 = "" + val1;
        op2 = "" + op1;
      }
      else {
        if (op1 == "p")
          temp = Math.pow(val1, temp);
        else
          temp = eval(val1 + op1 + temp);
      }

      if (op2) {
        if (op2 == "+ " || op2 == "- ") {
          val1 = "" + val2;
          op1 = "" + op2;
        }
        else {
          temp = eval(val2 + op2 + temp);
          val2 = "";
          op2 = "";
        }

        if (op3) { /* must be + or - */
          val2 = "" + val3;
          op2 = "" + op3;
          val3 = "";
          op3 = "";
        }
      }
    }
  }
  
	changeFormat2(2,temp)
  val1 = "" + temp;
  op1 = op + " ";
  isval = 0;
  oplast = 1;
}

function pow() {
  if (oplast) {
    op1 = 'p';
    return;
  }
  changeFormat2(1, document.calculator.display.value);
  var temp = "" + ChangeVar;

  if (op1) {
    if (op1 == 'p') {
      temp = Math.pow(val1, temp);
    }
    else {
      if (op2) {
        val3 = "" + val2;
        op3 = "" + op2;
      }
      val2 = "" + val1;
      op2 = "" + op1;
    }
  }
  changeFormat2(2, temp);
  document.calculator.display.value = "" + ChangeVar;
  val1 = "" + temp;
  op1 = 'p';
  isval = 0;
  oplast = 1;
}

function equals() {
	//var s = new String(document.calculator.display.value);
	//			s = s.replace(",",".");
	changeFormat2(1,document.calculator.display.value)			
  var temp = "" + ChangeVar; //s;

  if (op1) {
    if (op1 == 'p')
      temp = Math.pow(val1, temp);
    else
      temp = eval(val1 + op1 + temp);
    op1 = "";
    val1 = 0;

    if (op2) {
      temp = eval(val2 + op2 + temp);
      op2 = "";
      val2 = "";

      if (op3) {
        temp = eval(val3 + op3 + temp);
        op3 = "";
        val3 = "";
      }
    }
  }
	//var ss = new String(temp);
	//ss = ss.replace(".",",");
	changeFormat2(2,temp)			
  document.calculator.display.value = "" + ChangeVar;
  isval = 0;
  oplast = 0;
}

function negate() {
  document.calculator.display.value = eval("- " + document.calculator.display.value);
}

function unary(func) {
changeFormat2(1,document.calculator.display.value);
ChangeVar = func(ChangeVar);
changeFormat2(2,ChangeVar);

  isval = 0;
  oplast = 0;
}

function square(x) {
  return x * x;
}
function log10(x) {
  return Math.log(x) / Math.LN10;
}

function pow10(x) {
  return Math.pow(10, x);
}

function inv(x) {
  return 1 / x;
}

function square(x) {
  return x * x;
}

function setconst(x) {
  document.calculator.display.value = x;
  isval = 1;
  oplast = 0;
}

function clear() {
  if (oplast) clear_all();
  document.calculator.display.value = 0;
  isval = 0;
}

function clear_all() {
  document.calculator.display.value = 0;
  
  isval = 0;
  oplast = 0;
  val1 = 0;
  val2 = "";
  val3 = "";
  op1 = "";
  op2 = "";
  op3 = "";
}

function parse_input() {
  document.calculator.display.blur();
  window.status = document.calculator.display.value;

  document.calculator.display.focus();
  return false;
}

//slutt her
//BMI kalkulator
function beregn(form)
			{
			var H = new String (form.TxtH.value);
			H = H.replace(",",".");				
			var V = new String (form.TxtV.value);
			V = V.replace(",",".");		
			
				Hd = (H)/100;  
				B = (V)/(Hd*Hd);	
				BB = "" + B;
				len = BB.length;
				//form.LblSvar.value = BB.substring(4,0) 
				
			//var s = new String(form.LblSvar.value);
			//s = s.replace(".",",");
			//form.LblSvar.value = s
			changeFormat2(2,BB.substring(4,0));
			form.LblSvar.value = ChangeVar;
			}

// Vis/Skjul kalkulator			
function hideAll(layer_ref1,layer_ref2,layer_ref3,layer_ref4) {
			
			if (document.all) { //IS IE 4 or 5 (or 6 beta)
			
			
			eval( "document.all." + layer_ref1 + ".style.visibility = 'hidden'");
			eval( "document.all." + layer_ref2 + ".style.visibility = 'hidden'");
			eval( "document.all." + layer_ref3 + ".style.visibility = 'hidden'");
			eval( "document.all." + layer_ref4 + ".style.visibility = 'hidden'");
			}
			}

function hideMe(layer_ref) {
			
				if (document.all) { //IS IE 4 or 5 (or 6 beta)
				eval( "document.all." + layer_ref + ".style.visibility = 'hidden'");
				}
				if (document.layers) { //IS NETSCAPE 4 or below
				document.layers[layer_ref].visibility = 'hidden';
				}	
			}
			
function showMe(layer_ref) {
			
				hideAll('Val','prosent','kalkulatoren','BMI')
				eval( "document.BMIForm.TxtH.value = ' '");
				eval( "document.BMIForm.TxtV.value = ' '");
				eval( "document.BMIForm.LblSvar.value = ' '");
				document.calculator.display.value = "";
				
				
				if (document.all) { //IS IE 4 or 5 (or 6 beta)
				eval( "document.all." + layer_ref + ".style.visibility = 'visible'");
				
				}
				if (document.layers) { //IS NETSCAPE 4 or below
				document.layers[layer_ref].visibility = 'visible';
				}		
			}
// Gamlekalkulator
var indec = 0
var memor = 0

function DisplaySym(number) {
			document.calculator.display.value += number;
			changeFormat2(2,document.calculator.display.value )
			//changeFormat();
			
			}

function BackSpace() {
			document.calculator.display.value = document.calculator.display.value.substring(0, document.calculator.display.value.length - 1);
			changeFormat();
			}

function Do_Math() {  
			var s = new String(document.calculator.display.value);
				for ( x = 0; x < s.length; x++ ) {
				s = s.replace(",",".");
				}
				document.calculator.display.value = s
			if ( document.calculator.display.value != "" && document.calculator.display.value != parseInt(document.calculator.display.value) ) {
				var hold  = eval(document.calculator.display.value);
				document.calculator.display.value = hold;
				changeFormat();
			}
			}

function DisplayClear() {
			document.calculator.display.value = ""
			}
			                     
function NumberCheck(number2)  {
			y = 0;	
			for ( x = 0; x < number2.length; x++ ) {
			var numcheck = number2.substring(x, x+1)
				if ( numcheck < "0" || numcheck > "9" ) {
				if ( numcheck != "," && numcheck != "/" && numcheck != "*" && numcheck != "-" && numcheck != "+"  && numcheck != "." && numcheck != "("  && numcheck != ")"  ) {
					x = number2.length;
					y = 1;
				} 
				if ( numcheck == "^" ) {
					y = 2;
				}
				}
				}
				if ( y == 0 ) {	
				
					Do_Math()
					
			}
				if ( y == 1 ) {
					alert("Ugyldig verdi.");
			}
				if ( y == 2 ) {				
					Higher_Math3(number2)
			}
			}

function Higher_Math(process)  {
			if ( document.calculator.Deg[0].checked ) {
				if ( process == "sin" || process == "cos" || process == "tan" ) {
				temp = eval("(" + document.calculator.display.value + "/" + "180) * Math.PI");
				} 
				} else {
				temp = parseFloat(document.calculator.display.value)
				}
				var m = "Math." + process + "(" + temp + ")";
				document.calculator.display.value =  eval(m); 
				changeFormat();
			}

function Higher_Math2()  {
				document.calculator.display.value =  Math.pow(document.calculator.display.value,2)  
				changeFormat();
				}

function Higher_Math3(number3)  {
			for ( x = 0; x < number3.length; x++ ) {
			var numcheck = number3.substring(x, x+1)
				if ( numcheck == "^" ) {
				number4 = number3.substring(0,x);
				number5 = number3.substring(x+1,number3.length);
				x=number3.length;
			}
			}
			document.calculator.display.value = Math.pow(number4,number5)
			changeFormat();
			}

function Percent() {
			document.calculator.display.value = parseFloat(document.calculator.display.value) / 100;			
			changeFormat();
			}
function changeFormat()
			{			
				var s = new String(document.calculator.display.value);
				s = s.replace(".",",");
				document.calculator.display.value = s
			}
//Kalkulator: fra . til ,
function changeFormat2(t,display)

			{				
			if ( t == 1 ){		
				var s = new String(display);
				s = s.replace(",",".");
				}
			if ( t == 2 ) {
				var s = new String(display);
				s = s.replace(".",",");
				}				
				ChangeVar = s;	
				document.calculator.display.value 	= ChangeVar;		
			}			
//Valuta kalkulator
function restoreDefault() {
			for (var i = 0; i < document.valuta.fraValuta.length; i++) {
				if (document.valuta.fraValuta.options[i].defaultSelected == true) {
					document.valuta.fraValuta.options[i].selected=true;
				}
			}
			for (var i = 0; i < document.valuta.tilValuta.length; i++) {
				if (document.valuta.tilValuta.options[i].defaultSelected == true) {
					document.valuta.tilValuta.options[i].selected=true;
				}
			}
			document.valuta.utPenger.value = ' ';
			document.valuta.innPenger.value = 100;
			}

function regnUt(form) {
			
				EUR = 7.6672;
				USD = 6.1019;  
				BATH = 13.9400;
				GBP = 11.27600;
				
			
				valgtUt = form.tilValuta.selectedIndex;

				if (valgtUt == 0) veksleKurs = 1;

				if (valgtUt == 1) veksleKurs = EUR;
				if (valgtUt == 2) veksleKurs = USD;
				if (valgtUt == 3) veksleKurs = ( BATH / 100 )  ;
				if (valgtUt == 4) veksleKurs = GBP;
				
				var ss = new String(form.innPenger.value);
				ss = ss.replace(",",".");
				valgtInn = form.fraValuta.selectedIndex;
				harPenger = ss;//form.innPenger.value;

				if (valgtInn == 0) harPenger *= 1;
				if (valgtInn == 1) harPenger *= EUR;
				if (valgtInn == 2) harPenger *= USD;
				if (valgtInn == 3) harPenger *= ( BATH / 100 ) ;
				if (valgtInn == 4) harPenger *= GBP;
			    

			form.utPenger.value = (Math.floor (10000*harPenger / veksleKurs) /10000);
			var s = new String(form.utPenger.value);
				s = s.replace(".",",");
				form.utPenger.value = s
			}
//Tilbake hoveside
function Show()
			{				
				x = event.clientX + document.body.scrollLeft;				
				y = event.clientY + document.body.scrollTop + 35;				
				Popup.style.display="block";				
				Popup.style.left = x;				
				Popup.style.top = y;
			}
function Hide()	{Popup.style.display="none";}

//Mal
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// 07Descember 2006
var gService = false;
var gTimeZone = 1;
// Code section for Enable First-Party Cookie Tracking
function dcsCookie(){
	if (typeof(dcsOther)=="function"){
		dcsOther();
	}
	else if (typeof(dcsPlugin)=="function"){
		dcsPlugin();
	}
	else if (typeof(dcsFPC)=="function"){
		dcsFPC(gTimeZone);
	}
}
function dcsGetCookie(name){
	var pos=document.cookie.indexOf(name+"=");
	if (pos!=-1){
		var start=pos+name.length+1;
		var end=document.cookie.indexOf(";",start);
		if (end==-1){
			end=document.cookie.length;
		}
		return unescape(document.cookie.substring(start,end));
	}
	return null;
}
function dcsGetCrumb(name,crumb){
	var aCookie=dcsGetCookie(name).split(":");
	for (var i=0;i<aCookie.length;i++){
		var aCrumb=aCookie[i].split("=");
		if (crumb==aCrumb[0]){
			return aCrumb[1];
		}
	}
	return null;
}
function dcsGetIdCrumb(name,crumb){
	var cookie=dcsGetCookie(name);
	var id=cookie.substring(0,cookie.indexOf(":lv="));
	var aCrumb=id.split("=");
	for (var i=0;i<aCrumb.length;i++){
		if (crumb==aCrumb[0]){
			return aCrumb[1];
		}
	}
	return null;
}
function dcsFPC(offset){
	if (typeof(offset)=="undefined"){
		return;
	}
	if (document.cookie.indexOf("WTLOPTOUT=")!=-1){
		return;
	}
	var name=gFpc;
	var dCur=new Date();
	var adj=(dCur.getTimezoneOffset()*60000)+(offset*3600000);
	dCur.setTime(dCur.getTime()+adj);
	var dExp=new Date(dCur.getTime()+315360000000);
	var dSes=new Date(dCur.getTime());
	WT.co_f=WT.vt_sid=WT.vt_f=WT.vt_f_a=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";
	if (document.cookie.indexOf(name+"=")==-1){
		if ((typeof(gWtId)!="undefined")&&(gWtId!="")){
			WT.co_f=gWtId;
		}
		else if ((typeof(gTempWtId)!="undefined")&&(gTempWtId!="")){
			WT.co_f=gTempWtId;
			WT.vt_f="1";
		}
		else{
			WT.co_f="2";
			var cur=dCur.getTime().toString();
			for (var i=2;i<=(32-cur.length);i++){
				WT.co_f+=Math.floor(Math.random()*16.0).toString(16);
			}
			WT.co_f+=cur;
			WT.vt_f="1";
		}
		if (typeof(gWtAccountRollup)=="undefined"){
			WT.vt_f_a="1";
		}
		WT.vt_f_s=WT.vt_f_d="1";
		WT.vt_f_tlh=WT.vt_f_tlv="0";
	}
	else{
		var id=dcsGetIdCrumb(name,"id");
		var lv=parseInt(dcsGetCrumb(name,"lv"));
		var ss=parseInt(dcsGetCrumb(name,"ss"));
		if ((id==null)||(id=="null")||isNaN(lv)||isNaN(ss)){
			return;
		}
		WT.co_f=id;
		var dLst=new Date(lv);
		WT.vt_f_tlh=Math.floor((dLst.getTime()-adj)/1000);
		dSes.setTime(ss);
		if ((dCur.getTime()>(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){
			WT.vt_f_tlv=Math.floor((dSes.getTime()-adj)/1000);
			dSes.setTime(dCur.getTime());
			WT.vt_f_s="1";
		}
		if ((dCur.getDay()!=dLst.getDay())||(dCur.getMonth()!=dLst.getMonth())||(dCur.getYear()!=dLst.getYear())){
			WT.vt_f_d="1";
		}
	}
	WT.co_f=escape(WT.co_f);
	WT.vt_sid=WT.co_f+"."+(dSes.getTime()-adj);
	var expiry="; expires="+dExp.toGMTString();
	document.cookie=name+"="+"id="+WT.co_f+":lv="+dCur.getTime().toString()+":ss="+dSes.getTime().toString()+expiry+"; path=/"+(((typeof(gFpcDom)!="undefined")&&(gFpcDom!=""))?("; domain="+gFpcDom):(""));
	if (document.cookie.indexOf(name+"=")==-1){
		WT.co_f=WT.vt_sid=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";
		WT.vt_f=WT.vt_f_a="2";
	}
}

// Code section for Enable Event Tracking
function dcsParseSvl(sv){
	sv=sv.split(" ").join("");
	sv=sv.split("\t").join("");
	sv=sv.split("\n").join("");
	var pos=sv.toUpperCase().indexOf("WT.SVL=");
	if (pos!=-1){
		var start=pos+8;
		var end=sv.indexOf('"',start);
		if (end==-1){
			end=sv.indexOf("'",start);
			if (end==-1){
				end=sv.length;
			}
		}
		return sv.substring(start,end);
	}
	return "";
}
function dcsIsOnsite(host){
    var doms="vox.no";
    var aDoms=doms.split(',');
    for (var i=0;i<aDoms.length;i++){
		if (host.indexOf(aDoms[i])!=-1){
		       return 1;
		}
    }
    return 0;
}
function dcsIsHttp(e){
	return (e.href&&e.protocol&&(e.protocol.indexOf("http")!=-1))?true:false;
}

var gHref="";
function dcsSaveHref(evt){
	if (evt.preventDefault&&evt.target.href){
		evt.preventDefault();
		gHref=evt.target.href;
	}
}
function dcsLoadHref(evt){
	if (gHref.length>0){
		window.location=gHref;
		gHref="";
	}
}
function dcsEvt(evt,tag){
	var e=evt.target||evt.srcElement;
	while (e.tagName&&(e.tagName!=tag)){
		e=e.parentElement||e.parentNode;
	}
	return e;
}
function dcsBind(event,func){
	if ((typeof(window[func])=="function")&&document.body){
		if (document.body.addEventListener){
			document.body.addEventListener(event, window[func], true);
		}
		else if(document.body.attachEvent){
			document.body.attachEvent("on"+event, window[func]);
		}
	}
}
function dcsET(){
	dcsBind("click","dcsDownload");
	dcsBind("click","dcsDynamic");
	dcsBind("click","dcsFormButton");
	dcsBind("click","dcsOffsite");
	dcsBind("click","dcsAnchor");
	dcsBind("mousedown","dcsRightClick");
}
	
function dcsMultiTrack(){
	if (arguments.length%2==0){
		for (var i=0;i<arguments.length;i+=2){
			if (arguments[i].indexOf('WT.')==0){
				WT[arguments[i].substring(3)]=arguments[i+1];
			}
			else if (arguments[i].indexOf('DCS.')==0){
				DCS[arguments[i].substring(4)]=arguments[i+1];
			}
			else if (arguments[i].indexOf('DCSext.')==0){
				DCSext[arguments[i].substring(7)]=arguments[i+1];
			}
		}
		var dCurrent=new Date();
		DCS.dcsdat=dCurrent.getTime();
		dcsFunc("dcsCookie");
		dcsTag();
	}
}

// Add event handlers here

function dcsAdv(){
	dcsFunc("dcsET");
	dcsFunc("dcsCookie");
	dcsFunc("dcsAdSearch");
	dcsFunc("dcsTP");
}
// END OF Advanced SmartSource Data Collector TAG

// START OF Basic SmartSource Data Collector TAG
var gImages=new Array;
var gIndex=0;
var DCS=new Object();
var WT=new Object();
var DCSext=new Object();
var gQP=new Array();
var gI18n=false;
if (window.RegExp){
	var RE={"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g,"%22":/\"/g,"%7F":/\x7F/g,"%A0":/\xA0/g};
	var I18NRE={"%25":/\%/g};
}

// Add customizations here

function dcsVar(){
	var dCurrent=new Date();
	WT.tz=dCurrent.getTimezoneOffset()/60*-1;
	if (WT.tz==0){
		WT.tz="0";
	}
	WT.bh=dCurrent.getHours();
	WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;
	if (typeof(screen)=="object"){
		WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth;
		WT.sr=screen.width+"x"+screen.height;
	}
	if (typeof(navigator.javaEnabled())=="boolean"){
		WT.jo=navigator.javaEnabled()?"Yes":"No";
	}
	if (document.title){
		WT.ti=gI18n?dcsEscape(dcsEncode(document.title),I18NRE):document.title;
	}
	WT.js="Yes";
	WT.jv=dcsJV();
	if (document.body&&document.body.addBehavior){
		document.body.addBehavior("#default#clientCaps");
		if (document.body.connectionType){
			WT.ct=document.body.connectionType;
		}
		document.body.addBehavior("#default#homePage");
		WT.hp=document.body.isHomePage(location.href)?"1":"0";
	}
	if (parseInt(navigator.appVersion)>3){
		if ((navigator.appName=="Microsoft Internet Explorer")&&document.body){
			WT.bs=document.body.offsetWidth+"x"+document.body.offsetHeight;
		}
		else if (navigator.appName=="Netscape"){
			WT.bs=window.innerWidth+"x"+window.innerHeight;
		}
	}
	WT.fi="No";
	if (window.ActiveXObject){
		for(var i=10;i>0;i--){
			try{
				var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
				WT.fi="Yes";
				WT.fv=i+".0";
				break;
			}
			catch(e){
			}
		}
	}
	else if (navigator.plugins&&navigator.plugins.length){
		for (var i=0;i<navigator.plugins.length;i++){
			if (navigator.plugins[i].name.indexOf('Shockwave Flash')!=-1){
				WT.fi="Yes";
				WT.fv=navigator.plugins[i].description.split(" ")[2];
				break;
			}
		}
	}
	if (gI18n){
		WT.em=(typeof(encodeURIComponent)=="function")?"uri":"esc";
		if (typeof(document.defaultCharset)=="string"){
			WT.le=document.defaultCharset;
		} 
		else if (typeof(document.characterSet)=="string"){
			WT.le=document.characterSet;
		}
	}
	DCS.dcsdat=dCurrent.getTime();
	DCS.dcssip=window.location.hostname;
	DCS.dcsuri=window.location.pathname;
	if (window.location.search){
		DCS.dcsqry=window.location.search;
		if (gQP.length>0){
			for (var i=0;i<gQP.length;i++){
				var pos=DCS.dcsqry.indexOf(gQP[i]);
				if (pos!=-1){
					var front=DCS.dcsqry.substring(0,pos);
					var end=DCS.dcsqry.substring(pos+gQP[i].length,DCS.dcsqry.length);
					DCS.dcsqry=front+end;
				}
			}
		}
	}
	if ((window.document.referrer!="")&&(window.document.referrer!="-")){
		if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){
			DCS.dcsref=gI18n?dcsEscape(window.document.referrer, I18NRE):window.document.referrer;
		}
	}
}

function dcsA(N,V){
	return "&"+N+"="+dcsEscape(V, RE);
}

function dcsEscape(S, REL){
	if (typeof(REL)!="undefined"){
		var retStr = new String(S);
		for (R in REL){
			retStr = retStr.replace(REL[R],R);
		}
		return retStr;
	}
	else{
		return escape(S);
	}
}

function dcsEncode(S){
	return (typeof(encodeURIComponent)=="function")?encodeURIComponent(S):escape(S);
}

function dcsCreateImage(dcsSrc){
	if (document.images){
		gImages[gIndex]=new Image;
		if ((typeof(gHref)!="undefined")&&(gHref.length>0)){
			gImages[gIndex].onload=gImages[gIndex].onerror=dcsLoadHref;
		}
		gImages[gIndex].src=dcsSrc;
		gIndex++;
	}
	else{
		document.write('<IMG ALT="" BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1" SRC="'+dcsSrc+'">');
	}
}

function dcsMeta(){
	var elems;
	if (document.all){
		elems=document.all.tags("meta");
	}
	else if (document.documentElement){
		elems=document.getElementsByTagName("meta");
	}
	if (typeof(elems)!="undefined"){
		for (var i=1;i<=elems.length;i++){
			var meta=elems.item(i-1);
			if (meta.name){
				if (meta.name.indexOf('WT.')==0){
					WT[meta.name.substring(3)]=(gI18n&&(meta.name.indexOf('WT.ti')==0))?dcsEscape(dcsEncode(meta.content),I18NRE):meta.content;
				}
				else if (meta.name.indexOf('DCSext.')==0){
					DCSext[meta.name.substring(7)]=meta.content;
				}
				else if (meta.name.indexOf('DCS.')==0){
					DCS[meta.name.substring(4)]=(gI18n&&(meta.name.indexOf('DCS.dcsref')==0))?dcsEscape(meta.content,I18NRE):meta.content;
				}
			}
		}
	}
}

function dcsTag(){
	if (document.cookie.indexOf("WTLOPTOUT=")!=-1){
		return;
	}
	var P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+gDomain+(gDcsId==""?'':'/'+gDcsId)+"/dcs.gif?";
	for (N in DCS){
		if (DCS[N]) {
			P+=dcsA(N,DCS[N]);
		}
	}
	for (N in WT){
		if (WT[N]) {
			P+=dcsA("WT."+N,WT[N]);
		}
	}
	for (N in DCSext){
		if (DCSext[N]) {
			P+=dcsA(N,DCSext[N]);
		}
	}
	if (P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){
		P=P.substring(0,2040)+"&WT.tu=1";
	}
	dcsCreateImage(P);
}

function dcsJV(){
	var agt=navigator.userAgent.toLowerCase();
	var major=parseInt(navigator.appVersion);
	var mac=(agt.indexOf("mac")!=-1);
	var nn=((agt.indexOf("mozilla")!=-1)&&(agt.indexOf("compatible")==-1));
	var nn4=(nn&&(major==4));
	var nn6up=(nn&&(major>=5));
	var ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));
	var ie4=(ie&&(major==4)&&(agt.indexOf("msie 4")!=-1));
	var ie5up=(ie&&!ie4);
	var op=(agt.indexOf("opera")!=-1);
	var op5=(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1);
	var op6=(agt.indexOf("opera 6")!=-1||agt.indexOf("opera/6")!=-1);
	var op7up=(op&&!op5&&!op6);
	var jv="1.1";
	if (nn6up||op7up){
		jv="1.5";
	}
	else if ((mac&&ie5up)||op6){
		jv="1.4";
	}
	else if (ie5up||nn4||op5){
		jv="1.3";
	}
	else if (ie4){
		jv="1.2";
	}
	return jv;
}

function dcsFunc(func){
	if (typeof(window[func])=="function"){
		window[func]();
	}
}

dcsVar();
dcsMeta();
dcsFunc("dcsAdv");
dcsTag();
// END OF Basic SmartSource Data Collector TAG
