﻿// JScript File

var arCurrency=new Array('USD','JPY','BGN','CYP','CZK','DKK','EEK','GBP','HUF','LTL','LVL','MTL','PLN','RON','SEK','SKK','CHF','ISK','NOK','HRK','RUB','TRY','AUD','CAD','CNY','HKD','IDR','KRW','MYR','NZD','PHP','SGD','THB','ZAR','EUR');
var imgError = new Image(); imgError.src = "/Graphic/Nopicture52.gif"
var imgNone = new Image(); imgNone.src = "/Graphic/Nopicture52.gif"

var xmlHttp;
var arCountryCode=new Array('');
var MycArr=new Array('');

function IsPopupBlocker() {
var oWin = window.open ("","testpopupblocker","width=100,height=50,top=5000,left=5000");
if (oWin==null || typeof(oWin)=="undefined") {
return true;
} else {
oWin.close();
return false;
}
}

function SetCur(aCode)
{
  MySelElem = document.getElementById('SelCurrency');
  if (MySelElem) 
  {
    if (MySelElem.options.length == 1) 
    {
    MySelElem.options.length = 0;
    for (x = 0; x < arCurrency.length; ++ x) {
       
            var oOption = document.createElement('option');
            oOption.value = arCurrency[x];
            oOption.innerHTML = arCurrency[x];   
            if (aCode==arCurrency[x]) { oOption.selected=true; }
            MySelElem.appendChild(oOption);
    }    
    }  
  } 
}

function SetCou(aCode)
{
  MySelElem = document.getElementById('SelCountry');
  if (MySelElem) 
  {
    if (MySelElem.options.length == 1) 
    {
        MySelElem.options.length = 0;
        
        if(xmlHttp && xmlHttp.readyState != 0) {
            xmlHttp.abort()
        }        
        xmlHttp=getXMLHTTP();
        if(xmlHttp)
        {
            
            xmlHttp.open("GET", "/Include/js/GetCountry.asp", true);
            // What do we do when the response comes back?
            xmlHttp.onreadystatechange = function() {
              if (xmlHttp.readyState == 4 && xmlHttp.responseText) {
                eval(xmlHttp.responseText);
                for (x = 0; x < MycArr.length; ++ x) {
                   
                        var oOption = document.createElement('option');
                        oOption.value = arCountryCode[x];
                        oOption.innerHTML = MycArr[x];   
                        if (aCode==arCountryCode[x]) { oOption.selected=true; }
                        MySelElem.appendChild(oOption);
                }                
              }
            };
            xmlHttp.send(null);
        }         
    }  
  } 
}

/**
This sets up the XMLHTTP object 
*/
function getXMLHTTP(){
  var A = null;
  
  try{
    A = new ActiveXObject("Msxml2.XMLHTTP");
  }catch(e){
    try{
      A = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(oc){
      A = null;
    }
  }
  
  if(!A && typeof XMLHttpRequest != "undefined") {
    A = new XMLHttpRequest();
  }
  
  return A;
}

function doError(msg,url,ln) {  
 var strValues = "errMsg=" + escape(msg); 
 strValues += "&errLine=" + ln;    
 strValues += "&queryString=" + escape(location.search);    
 strValues += "&Url=" + escape(location.pathname);    
 strValues += "&HTTPRef=" + escape(document.referrer); 
 if (typeof XMLHttpRequest != "object") {        
  function XMLHttpRequest() { return new ActiveXObject("Microsoft.XMLHTTP"); }    
 }   
 var objSave = new XMLHttpRequest();    
 objSave.open("GET", "/errorSave/?" + strValues, false); 
 objSave.send("");
}
 
try { window.onerror = doError; }
catch(er) {}

function imgErr(aThis)
{
aThis.src = imgError.src;
aThis.title='Billedet kan ikke vises';
}  

function ShowBar(aName) 
{
var aelem;
aelem = document.getElementById(aName);
if (aelem) {
aelem.style.display='block';
}
}

