<!--
function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}
// digits only 
function isDigit(f)
{   var reDigit = /^\d+$/;
    return (reDigit.test(f))
}

function openSearchWin(strInfoName) {
	var w = 250;
	var h = 100;
	var x = (screen.width - w) / 2;
	var y = (screen.height - h) / 2;
	if (window.parent && window.parent.frames["toppen"]) {
		window.parent.frames["toppen"].popupWindow = window.open("/book/ASP/book_info_popup.asp?info_name=" + strInfoName, "nisse", "width=" + w + ",height=" + h + ",top=" + y + ",left=" + x);
		window.parent.frames["toppen"].popupWindow.focus();
	}
}

function goSingleHotel(hotcd, mucd, destcd){
document.pricecompare.action = 'hotel_single.asp'; 
document.pricecompare["HOTCD"].value = hotcd;
document.pricecompare["MUCD"].value = mucd;
document.pricecompare["DESTCD"].value = destcd;
document.pricecompare.submit();

}

function goRequest() {
	document.pricecompare.action = '/book/ASP/book.asp';
	document.pricecompare["ENTRYPOINT"].value = "REQUEST";
//	document.pricecompare["INTFUNCCD"].value = "";
//	document.pricecompare["WEBSRVCD"].value = "";
//	document.pricecompare["WEBSCREENCD"].value = "";
//	document.pricecompare["REQUEST_MUCD"].value = "RS";
	
	if (document.pricecompare["DESTCD"] && document.pricecompare["DESTCD"].value.length > 0) {
		document.pricecompare["ADDHOTELS"].value = "Y";
	}
	document.pricecompare.submit();
	return false;
}

function goRequestSingle() {
	document.matrix_form.action = '/book/ASP/book.asp';
	document.matrix_form["ENTRYPOINT"].value = "REQUEST";
//	document.matrix_form["INTFUNCCD"].value = "";
//	document.matrix_form["WEBSRVCD"].value = "";
//	document.matrix_form["WEBSCREENCD"].value = "";
//	document.matrix_form["REQUEST_MUCD"].value = "RS";
	
	if (document.matrix_form["DESTCD"] && document.matrix_form["DESTCD"].value.length > 0) {
		document.matrix_form["ADDHOTELS"].value = "Y";
	}
	document.matrix_form.submit();
	return false;
}

function getVTAHotelPriceSingle(destcd, mucd, hotcd, dd, mm, yy){	
	var f1 = document.matrix_form ;
	if (typeof(f1) == 'undefined')  {  
		f1 = document.form1 ;
	}
	f1.action = '/book/ASP/book.asp';
	f1["ENTRYPOINT"].value = "PACKAGE";	
	f1["DESTCD"].value = destcd;
	f1["MUCD"].value = mucd;	
	f1["HOTCD"].value = hotcd;
	f1["DD"].value = dd;
	f1["MM"].value = mm;
	f1["YY"].value = yy;
	f1["CID_CCYY"].value = yy;
	f1["CID_MM"].value = mm;
	f1["CID_DD"].value = dd;
	f1["WEBSCREENCD"].value = "";
	f1["WEBSRVCD"].value = "";
	f1["INTFUNCCD"].value = "";
	f1["BOOKMUCD"].value = mucd;
	f1["GEOTP"].value = "DE";	
	f1.submit();
	return false;
}

function getVTAHotelPrice(destcd, mucd, hotcd, dd, mm, yy, destcdname){	
	document.pricecompare.action = '/book/ASP/book.asp';
	document.pricecompare["ENTRYPOINT"].value = "PACKAGE";
	document.pricecompare["DESTCD"].value = destcd;
	document.pricecompare["DESTCDNAME"].value = destcdname;
	document.pricecompare["MUCD"].value = mucd;	
	document.pricecompare["HOTCD"].value = hotcd;	
	document.pricecompare["DD"].value = dd;
	document.pricecompare["MM"].value = mm;
	document.pricecompare["YY"].value = yy;
	document.pricecompare["CID_CCYY"].value = yy;
	document.pricecompare["CID_MM"].value = mm;
	document.pricecompare["CID_DD"].value = dd;
	document.pricecompare["WEBSCREENCD"].value = "";
	document.pricecompare["WEBSRVCD"].value = "";
	document.pricecompare["INTFUNCCD"].value = "";
	document.pricecompare["BOOKMUCD"].value = mucd;
	document.pricecompare["GEOTP"].value = "DE";
	document.pricecompare.submit();
	return false;
}

function popIntro() {
		window.open('/frontpage/ASP/intro.asp','intro','width=640,height=228,screenX=170,screenY=140,top=140,left=170,resizeable=no,scrollbars=no,toolbar=no');
}

function show(ShowLayer) {
	if (navigator.appName == "Netscape") {
		document.eval(ShowLayer).visibility="show";
		return false;
	} 
	else {
		document.all[ShowLayer].style.visibility="visible";
		return false;
	}
}


function hide(HideLayer) {
	if (navigator.appName == "Netscape") {
		document.eval(HideLayer).visibility="hide";
		return false;
	} 
	else {
		document.all[HideLayer].style.visibility="hidden";
		return false;
	}
}


var fonsterETT = document;
var temp1 = screen.availWidth;
var temp2 = screen.availHeight;
var winWIDTH = temp1/2;
var winHEIGHT = temp2/2;

function displayMov(whatPage) {
	fonsterETT = open(whatPage,"Mov","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=590,height=383");
	fonsterETT.moveTo(winWIDTH-295, winHEIGHT-191);	
}

function displayPris(whatPage) {
	fonsterETT = open(whatPage,"Pris","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=615,height=313");
	fonsterETT.moveTo(winWIDTH-307, winHEIGHT-156);	
}

function displayMap(whatPage) {
	fonsterETT = open(whatPage,"Map","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=364,height=600");
	fonsterETT.moveTo(winWIDTH-305, winHEIGHT-305);	
}

var windowHandle = '';
function go(what) {
    windowHandle = window.open(what[what.selectedIndex].value,'windowName','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=360,height=280');
}


ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function ladda(page) {
	if (ns4) document.textLayer.src = page
	else if (ie4) textFrame.document.location = page
}

function visa(id) {
	if (ns4) document.textLayer.visibility = "show"
	else if (ie4) document.all[id].style.visibility = "visible"
}

function gomma(id) {
	if (ns4) document.textLayer.visibility = "hide"
	else if (ie4) document.all[id].style.visibility = "hidden"
}

function ImgClose() 
{
	if (navigator.appName == 'Microsoft Internet Explorer')
		what = parent.gomma('textDiv');
	else
		what = self.gomma('textDiv');
}


var isIE = navigator.appVersion.indexOf("MSIE")>0
if (navigator.appVersion.toLowerCase().indexOf('mac') !=-1)
 if (isIE)  {
     popw = 579;
	 poph = 373;
     } 
	 else
     { 
     popw = 594;
	 poph = 389;
     }   
else
    {
	popw = 594;
	poph = 389;
	}
	
function windowOpen(popw,poph) {
    myWindow = window.open("","windowRef","width=" + popw + ",height=" + poph + ",top=0,left=0,screenX=0,screenY=0");
    myWindow.location.href = "rg/bilder_frame.html";
    if (!myWindow.opener) myWindow.opener = self;
}

function myVoid() {;}

//This function is used to encode the passed on url for the frame-setter function below. (SetTopNavHighLights)
function urlEncode(inStr) {
outStr=' '; //not '' for a NS bug!
for (i=0; i < inStr.length; i++) {
aChar=inStr.substring (i, i+1);
switch(aChar){
case '%': outStr += "%25"; break; case ',': outStr += "%2C"; break;
case '/': outStr += "%2F"; break; case ':': outStr += "%3A"; break;
case '~': outStr += "%7E"; break; case '!': outStr += "%21"; break;
case '"': outStr += "%22"; break; case '#': outStr += "%23"; break;
case '$': outStr += "%24"; break; case "'": outStr += "%27"; break;
case '`': outStr += "%60"; break; case '^': outStr += "%5E"; break;
case '&': outStr += "%26"; break; case '(': outStr += "%28"; break;
case ')': outStr += "%29"; break; case '+': outStr += "%2B"; break;
case '{': outStr += "%7B"; break; case '|': outStr += "%7C"; break;
case '}': outStr += "%7D"; break; case ';': outStr += "%3B"; break;
case '<': outStr += "%3C"; break; case '=': outStr += "%3D"; break;
case '>': outStr += "%3E"; break; case '?': outStr += "%3F"; break;
case '[': outStr += "%5B"; break; case '\\': outStr += "%5C"; break;
case ']': outStr += "%5D"; break; case ' ': outStr += "+"; break;
default: outStr += aChar;
}
}
return outStr.substring(1, outStr.length);
}

function PageInitFunction()
	{
	if (top.frames.length == 0)
		{
		window.location.href='/default.asp?page='+urlEncode(window.location.href);
		return true;
		}
	return false;
	}
	
	
function SetTopNavHighLights(TabNo)
	{
	
	if (top.frames.length == 0)
		{
		window.location.href='/default.asp?page='+urlEncode(window.location.href)
		}

	// Bortkommenterat av Lotta iochmed den nya designen

	//else
	//	{
	//	//begin by low-lighting all the tabs.
	//	for(var i=1;i<4;i++)
	//		{
	//		window.parent.frames.toppen.di('Ntab_01_0'+i,'Itab_01_0'+i);
	//		}
    //
	//	//Highlight the choosen Tab, unless TabNo=-1 in which case we do nothing.
	//	if (TabNo>0 && TabNo<4) window.parent.frames.toppen.di('Ntab_01_0'+TabNo,'Itab_01_0'+TabNo+'o');
	//	}
	}
	
// check if email is correct
//Petra byter ut tre till fyra sista siffror i emailadress.. tex petra@mail.info
function isEmail( f )  {
  var r1 = new RegExp( "(@.*@)|(\\.\\.)|(@\\.)|(^\\.)" ) ;
//var r2 = new RegExp( "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$" ) ;
  var r2 = new RegExp( "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"); 
  return ( !r1.test( f.value ) && r2.test( f.value ) ) ;
}

function OpenRating(newin,width,height,scroll,resize)
{   
	var str = new String(newin);
	var re = / /g;
	str = str.replace(re, '%20');
	flyout=window.open(str,"poprating","resizable="+resize+",scrollbars="+scroll+",width="+width+",height="+height+",screenX=130,screenY=20,top=20,left=130")
}

function Open(newin,width,height,scroll,resize)
{   
	var str = new String(newin);
	var re = / /g;
	str = str.replace(re, '%20');
	flyout=window.open(str,"pop","resizable="+resize+",scrollbars="+scroll+",width="+width+",height="+height+",screenX=130,screenY=20,top=20,left=130")
}

function OpenCenter(newin,width,height,scroll,resize)
{   
	var str = new String(newin);
	var re = / /g;
	var pX = (screen.width - width) / 2;
	var pY = (screen.height - height)/ 2;
	str = str.replace(re, '%20');
	//alert( "resizable="+resize+",scrollbars="+scroll+",width="+width+",height="+height+",screenX=" + pX + ",screenY=" + pY +",top=" + pX + ",left=" + pY ) ;
	flyout=window.open(str,"pop","resizable="+resize+",scrollbars="+scroll+",width="+width+",height="+height+",screenX=" + pX + ",screenY=" + pY + ",top=" + pX + ",left=" + pY);
}


function OpenPopUpWindow(strWhat, strID){
	var strURL = "", strHelpId, strWinName, win, width, height, strParams;

	if (strWhat == 'help')
	{
		if (strID == '-1'){
			
		    if (typeof(window.parent.frames[4].iHelpContextId) == 'unknown') {
			strHelpId = '3410'
			}
			else{
				strHelpId = window.parent.frames[4].iHelpContextId;
			}
			
			
			if (strHelpId == null) {
				strHelpId = '-1';
			}
		}
		else
			strHelpId = strID
		strURL = "/help15/asp/help_frame.asp?HelpId=" + strHelpId ;
		strWinName = "help";
		width = 717 ;
		height = 520 ;
	}
	else if (strWhat == 'FAQ')
	{
		strURL = "/help15/asp/faq_frame.asp?HelpId=" + strID ;
		strWinName = "help" ;
		width = 717 ;
		height = 520 ;
	}
	else if (strWhat == 'TC')
	{
		strURL = "/help15/asp/TC_frame.asp?HelpId=" + strID ;
		strWinName = "TC" ;
		width = 717 ;
		height = 520 ;
	}	
	else if (strWhat == 'categories')
	{
		strURL = "/search/asp/frame_categories.asp"
		strWinName = "popup" ;
		width = 478 ;
		height = 323 ;
	}	
	else if (strWhat == 'products')
	{
		strURL = "/search/asp/frame_products.asp?where=x" + strID;
		strWinName = "popup" ;
		width = 478 ;
		height = 323 ;
	}	
	else if (strWhat == 'guide')
	{
		if (isDigit(strID)){
			strURL = "/travelguide/ASP/guide_frame.asp?Type=theme&CD=" + strID;
		}
		else{
			strURL = "/travelguide/ASP/guide_frame.asp?CD=" + strID;
		}
		strWinName = "guide" ;
		width = 600 ;
		height = 400 ;
	}
	else if (strWhat == 'PI')
	{
		strURL = "/about/ASP/frame_PI.asp";
		strWinName = "PI" ;
		width = 600 ;
		height = 400 ;
	}		
	var pX = (screen.width - width) / 2;
	var pY = (screen.height - height)/ 2;
	//var pHeigth = pY
	if (strURL != ""){
		//strParams = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width="+width+",height="+height ;
		strParams = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,width="+width+",height="+height +",screenX=" + pX + ",screenY=" + pY  + ",top=50"  + ",left=" + pY ;

		win = window.open(strURL, strWinName, strParams ) ;
	}
}



//Trim removes starting and ending spaces
function Trim(strText){
var strReturnText;
var bNotFinished = true;

	strReturnText = strText;

	//Remove starting spaces
	while (bNotFinished && (strReturnText.length > 0)){
		if (strReturnText.substr(0,1) == String.fromCharCode(160)){
			strReturnText = strReturnText.substr(1, strReturnText.length)
		}
		else if (strReturnText.substr(0,1) == ' '){
			strReturnText = strReturnText.substr(1, strReturnText.length)
		}
		else bNotFinished = false;
	}
	
	//Remove ending spaces
	bNotFinished = true;
	while (bNotFinished && (strReturnText.length > 0)){
		position = strReturnText.length - 1;
		if (strReturnText.substr(position, 1) == String.fromCharCode(160)){
			strReturnText = strReturnText.substr(0, position)
		}
		else if (strReturnText.substr(position, 1) == ' '){

			strReturnText = strReturnText.substr(0, position)
		}
		else bNotFinished = false;
	}

	return strReturnText;
}

//Removes duplicates in a select-element
function clearDuplicateOptionBoth(){
	var selLength = document.valuta.from.length;
	var NSX ;
	if(navigator.appName == "Netscape"){
		NSX=true;	
	}
	var IE4 = (document.all) ? true : false;
	var strValue;
	var strParent;
	for (i = 0; i < selLength; i++) {
		
		if (i !=0){
			strParent=document.valuta.from[i-1].value;
			}
			strValue=document.valuta.from[i].value;

			if(strValue==strParent){
				selLength=selLength-1;
				i=i-1;
				if (NSX){
					document.valuta.to.options[i]=null;
					document.valuta.from.options[i]=null;
					history.go(0);
				}//	if (NSX){
			else if (IE4){
					document.valuta.to.remove(i);
					document.valuta.from.remove(i);
			}//else if (IE4){
			}
		}
}//function clearDuplicateOption(form){



function Setselected(r) {

	if (r) {
		if (document.valuta.from.selectedIndex == 0 && document.valuta.to.selectedIndex == 0) {
			document.valuta.from.selectedIndex = 1;
		} else {
			if (document.valuta.to.selectedIndex > 0) {
				document.valuta.from.selectedIndex = 0;
			}
		}
	} else {
		if (document.valuta.from.selectedIndex == 0 && document.valuta.to.selectedIndex == 0) {
			document.valuta.to.selectedIndex = 1;
		} else {
			if (document.valuta.from.selectedIndex > 0) {
				document.valuta.to.selectedIndex = 0;
			}
		}
	}
}
function boxsel(r) {
	if (r) {
		if (document.valuta.from.selectedIndex == 0 && document.valuta.to.selectedIndex == 0) {
			document.valuta.from.selectedIndex = 1;
		} else {
			if (document.valuta.to.selectedIndex > 0) {
				document.valuta.from.selectedIndex = 0;
			}
		}
	} else {
		if (document.valuta.from.selectedIndex == 0 && document.valuta.to.selectedIndex == 0) {
			document.valuta.to.selectedIndex = 1;
		} else {
			if (document.valuta.from.selectedIndex > 0) {
				document.valuta.to.selectedIndex = 0;
			}
		}
	}
	cnt();
}
function convertCurrency(str1,str2,str3,strError) {
	var sum;
	var kurs;
	var fromdesc;
	var todesc;
	var from;
	var lkf;
	var kop;
	from = document.valuta.amt.value;
	
	if ( !(from > 0) ) {
		lkf = new String(from);
		if (lkf.indexOf(",")) {
			u = lkf.split(",");
			from = u.join(".");	
		}
	} 
	
	if ( from > 0 ) {
	
	if (document.valuta.from.selectedIndex == 0) { 
		kop = 1;
		x = document.valuta.to.options[document.valuta.to.selectedIndex].value;
 	} else {
 		kop = 0;
 		x = document.valuta.from.options[document.valuta.from.selectedIndex].value;
 	}
	
	l = x.split(":");
	multi = l[0];
	buy = l[1];
	sell = l[2];
	if (kop) {
		sum = from*multi/buy;
		kurs= buy;
	} else {
		sum = from*sell/multi;
		kurs=sell;
	}
	
	rsum = new String(sum);
	jx = rsum.split(".");
	
	if (jx.length > 1) {
		if (jx[1].length > 2) { jx[1] = jx[1].substr(0,2); }
		sum = jx.join(".");
	} else {
		sum = jx[0];
	}
	todesc =document.valuta.to.options[document.valuta.to.selectedIndex].text
	fromdesc= document.valuta.from.options[document.valuta.from.selectedIndex].text
	document.valuta.txtCurrency.value = str1 + ' ' + from + ' ' + fromdesc + ' ' + str2 + ' '+ sum + ' ' + todesc + ' ' + str3  + ' '+ kurs;
	
	} else { if (from != "") { alert(strError); } }
}
	


function cnt() {
	from = document.valuta.amt.value;
	
	if ( !(from > 0) ) {
		lkf = new String(from);
		if (lkf.indexOf(",")) {
			u = lkf.split(",");
			from = u.join(".");	
		}
	} 
	
	if ( from > 0 ) {
	
	if (document.valuta.from.selectedIndex == 0) { 
		kop = 1;
		x = document.valuta.to.options[document.valuta.to.selectedIndex].value;
 	} else {
 		kop = 0;
 		x = document.valuta.from.options[document.valuta.from.selectedIndex].value;
 	}
	
	l = x.split(":");
	multi = l[0];
	buy = l[1];
	sell = l[2];

	if (kop) {
		sum = from*multi/sell;
		document.valuta.kurs.value = sell;
	} else {
		sum = from*buy/multi;
		document.valuta.kurs.value = buy;
	}
	
	rsum = new String(sum);
	jx = rsum.split(".");
	
	if (jx.length > 1) {
		if (jx[1].length > 2) { jx[1] = jx[1].substr(0,2); }
		sum = jx.join(".");
	} else {
		sum = jx[0];
	}
	
	document.valuta.summa.value = sum;
	
	} else { if (from != "") { alert("Valuta kan bara räknas i siffror..."); } }
}
	


// Validate any form
//
// strMandatory = Comma separated list with madatory fields 
// strForm = Name of the form
//
// The form needs to hidden fields MandatoryError and MandatoryMissing
//
function validate_form(strMandatory, strForm){
	var	intHit = 0;
	var objForm = document.forms[strForm];
	var	intLen= objForm.length;
	var strField;

	for(var i=0 ; i<intLen ; ++i ){
		if (objForm[i].type == "hidden")
			continue;
		strField=String(objForm[i].name);
		switch  (strField){
			case "fromemail": 
				if (! isEmail(objForm[i])) intHit = i;
				break;
			case "toemail": 
				if (! isEmail(objForm[i])) intHit = i;
				break;
			default:  
				if (! isSomething(objForm[i].value)) 
					intHit = i;				
				break;	
		}
		// Did we find an error?
		if (intHit > 0) {
			if (isMandatory(strMandatory, objForm[i].name)) {
				// If this was a mandatory field, alert the user
				if (objForm[i].value && (objForm[i].value.length > 0)) {
					alert(objForm.MandatoryError.value);
				} else {
					alert(objForm.MandatoryMissing.value);
				}
				if (objForm[i].select)
					objForm[i].select(); 
				objForm[i].focus();
				return false;			
			} else {
				intHit = 0;
			}
		}
	}	
	
	return true;
}

function isSomething(str) {
		if (str.length > 0) {
			return true;
		}	
	return false;
}

function isMandatory(strMandatory, strHit) {
	var strArr = strMandatory.split(',');
	for (var i=0;i<strArr.length;i++) {
		if (strHit.indexOf(strArr[i]) >= 0) {
			return true;
		}
	}
	return false;
}

//-->




