function popupRacespecial(imagename) {
	window.open('index.php?id=1463&racingpic='+imagename+'','KTMRacing','width=700,height=410,scrollbars=no');
}
function popupxchange(imagename) {
	window.open('index.php?id=1463&xchangepic='+imagename+'','KTMXChange','width=700,height=410,scrollbars=no');
}
function popupTourspecial(imagename) {
	window.open('index.php?id=6742&tourpic='+imagename,'KTMTours','width=700,height=410,scrollbars=no');
}
function popupProductspecials(imagename) {
	window.open('index.php?id=248&productspecialsID='+imagename+'','Productspecials','width=700,height=410,scrollbars=no');
}

function popupTravelspecial(imagename) {
	window.open('index.php?id=6750&travelID='+imagename+'','Travelspecials','width=700,height=410,scrollbars=no');
}

function popupFeaturebox(linkname,windowname,parameters) {
	window.open(linkname,windowname,parameters);
}
function tellafriend_old(tipp, type){
	window.open('tell-a-friend.100316.'+type+'.html?tipp='+tipp,'tellafriend','width=570,height=580,scrollbars=no,toolbar=no,location=no,status=no');	
}
function MM_swapImgRestore() {
  	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() {
  	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_swapImage() {
	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) {
	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);

function MM_findObj(n, d) {
	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_showHideLayers() {
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

wmtt = null;
/*var mousepos = new Array();
document.onmousemove = function (ev)
{
 mousepos = new Array(ev.pageX,ev.pageY);
}
*/
function updateWMTT(e) {
	if (document.all) {
	    x = window.event.x + document.body.scrollLeft;
    	y = window.event.y + document.body.scrollTop;
	} else {
		x = mousepos[0];
		y = mousepos[1];
	}
    if (wmtt!=null) {
    wmtt.style.left = (x + 15) + "px";
    wmtt.style.top 	= (y + 15) + "px";
    }
}

function updateWMTT_tour(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (wmtt != null) {
    wmtt.style.left = (x - 275) + "px";
    wmtt.style.top 	= (y - 15) + "px";
    }
}

function showWMTT(id) {
    wmtt = document.getElementById(id);
    wmtt.style.display = "block"
}

function hideWMTT() {
	wmtt.style.display = "none";
}

function dankeresult(vid,cr_counter1) {
	//alert(estop);	
	var vid1 = vid;
	if (cr_counter1 > 0) {
		cr_counter1 --;
		setTimeout("dankeresult("+vid+",0)",3000);
	} else {
		danke = document.getElementById('danke'+vid);
		danke.style.display = "none";
		ergebnis  = document.getElementById('results'+vid);
		ergebnis.style.display = "block";
		text  = document.getElementById('text'+vid);
		text.style.display = "block";
	}
}

function showevent(uid){
	baba = document.getElementById('terrow'+uid);
	baba.style.display = "none";
	detailinfo = document.getElementById('terrow2_'+uid);
	detailinfo.style.display = "";
}
function hideevent(uid){
	baba = document.getElementById('terrow2_'+uid);
	baba.style.display = "none";
	detailinfo = document.getElementById('terrow'+uid);
	detailinfo.style.display = "";
}
function cr_zoom(pic){
	scroll(0,0);
	d = document;
	d.getElementById('blacklayer').style.display = '';
	d.getElementById('zoomlayer').style.display = '';
	d.getElementById('zoompic').src = pic;
	//Effect.Appear("zoomlayer", {duration: 1});
}
function cr_zoomout(){
	d = document;
	d.getElementById('blacklayer').style.display = 'none';
	d.getElementById('zoomlayer').style.display = 'none';
	d.getElementById('zoompic').src = 'clear.gif';
}

function cr_print(){
	d = document;
	if(d.getElementById('printform')){
		document.printform.submit();
	}else{
		document.printformc.submit();
	}
}

function cr_checkchilli(nr){
	d = document;
	//alert(d.getElementById('level'+nr).checked)
	if(d.getElementById('level'+nr).checked == false){
		d.getElementById('chilli'+nr).src = 'fileadmin/images/tours/chili/chilli'+nr+'_high.gif';
	}else{
		d.getElementById('chilli'+nr).src = 'fileadmin/images/tours/chili/chilli'+nr+'.gif';
	}
}
function cr_selectchilli(nr){
	d = document;
	//alert(d.getElementById('level'+nr).checked)
	if(d.getElementById('level'+nr).checked == false){
		d.getElementById('level'+nr).checked = true;
		d.getElementById('chilli'+nr).src = 'fileadmin/images/tours/chili/chilli'+nr+'_high.gif';
	}else{
		d.getElementById('level'+nr).checked = false;
		d.getElementById('chilli'+nr).src = 'fileadmin/images/tours/chili/chilli'+nr+'.gif';
	}
}

function cr_checkchilli2(item, nr){		
	if (oldChilli > 0)
		$('chilli'+oldChilli).src = 'fileadmin/images/tours/chili/chilli'+oldChilli+'.gif';
		
	if (item.checked) {
		$('chilli'+nr).src = 'fileadmin/images/tours/chili/chilli'+nr+'_high.gif';
	}
	else{
		$('chilli'+nr).src = 'fileadmin/images/tours/chili/chilli'+nr+'.gif';
	} 
	oldChilli = nr;
	
}

function cr_selectchilli2(nr) {
	if (oldChilli > 0)
		$('chilli'+oldChilli).src = 'fileadmin/images/tours/chili/chilli'+oldChilli+'.gif';
		
	if($('level'+nr).checked == false){
		$('level'+nr).checked = true;
		$('chilli'+nr).src = 'fileadmin/images/tours/chili/chilli'+nr+'_high.gif';
	}
	else{
		$('level'+nr).checked = false;
		$('chilli'+nr).src = 'fileadmin/images/tours/chili/chilli'+nr+'.gif';
	}
	oldChilli = nr;
}

function cr_popstart(){
	setTimeout("cr_popstart1()",500);
}
function cr_popstart1(){
	scroll(0,0);
	d = document;
	d.getElementById('blacklayer').style.display = '';
	d.getElementById('startpopup').style.display = '';
	//Effect.Appear("zoomlayer", {duration: 1});
}

function cr_popout(){
	d = document;
	d.getElementById('blacklayer').style.display = 'none';
	d.getElementById('startpopup').style.display = 'none';
	if (document.getElementById('restorecontainer')) cr_cinema_baba();

}
function setcookie(name, value, days, path, domain, secure) { 
 var expires = -1; 
 if(typeof days == "number" && days >= 0) {
  var d = new Date(); d.setTime(d.getTime()+(days*24*60*60*1000)); expires = d.toGMTString(); 
 } 
 value = escape(value); 
 document.cookie = name + "=" + value + ";" + (expires != -1 ? " expires=" + expires + ";" : "") + (path ? "path=" + path : "") + (   domain ? "; domain=" + domain : "") + (secure ? "; secure" : ""); 
}

 function cr_undAUS(name,uid){
	 cr_popout();
	 setcookie(name, uid, 7);
 }
 
 
function cr_cinema(flv,new_width,new_height){
	// Layer
	//document.getElementById('cinema_layer').style.display = '';
	//document.getElementById('startpopup').style.display = 'none';
	
	//document.getElementById('cinema_layer').style.width = new_width+'px';
	//document.getElementById('cinema_layer').style.marginLeft = -(new_width/2)+'px';
	
	/*document.getElementById('startpopup').style.width = new_width+'px';
	document.getElementById('startpopup').style.height = new_height+'px';*/
	
	document.getElementById('oldFlash').style.display = 'none';
	document.getElementById('restorecontainer').style.marginLeft = '50px';
	//black
	window.scrollTo(0, 0);
	
	//SWF
	var flashvars = {
	  src: flv,
	  width: new_width,
	  height: new_height
	};
	var params = {
	  menu: "false",
	  wmode: "transparent",
	  allowScriptAccess: "sameDomain",
	  quality: "high",
	  allowfullscreen: true
	};
	var attributes = {
	  id: "flv_cinema",
	  name: "flv_cinema"
	};
	new_height1 = parseInt(new_height)+31;	
	//alert("swf:"+new_width+"x"+new_height1);
	//alert("flv:"+new_width+"x"+new_height);
	swfobject.embedSWF("fileadmin/markenwelten/swf/player/videoplayer.swf?src=/fileadmin/markenwelten/flv/"+flv+"&new_width="+new_width+"&new_height="+new_height, "flashcontainer", new_width, new_height1, "9.0.0","fileadmin/swf/expressInstall.swf", flashvars, params, attributes);

}
function cr_cinema_baba(){
	document.getElementById('blacklayer').style.display = "none";
	//document.getElementById('cinema_layer').style.display = "none";
	swfobject.removeSWF("flv_cinema");
	document.getElementById('restorecontainer').innerHTML = '<div id="flashcontainer"></div>';
}
 
HTTP_GET_VARS=new Array();
strGET=document.location.search.substr(1,document.location.search.length);
if(strGET!=''){
    gArr=strGET.split('&');
    for(i=0;i<gArr.length;++i){
        v='';
        vArr=gArr[i].split('=');
        if(vArr.length>1){v=vArr[1];}
        HTTP_GET_VARS[unescape(vArr[0])]=unescape(v);
    }
}

function GET(v){
    if(!HTTP_GET_VARS[v]){return 'undefined';}
    return HTTP_GET_VARS[v];
}
sprintfWrapper = {
 
	init : function () {
 
		if (typeof arguments == "undefined") { return null; }
		if (arguments.length < 1) { return null; }
		if (typeof arguments[0] != "string") { return null; }
		if (typeof RegExp == "undefined") { return null; }
 
		var string = arguments[0];
		var exp = new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d)?)?([bcdfosxX])))/g);
		var matches = new Array();
		var strings = new Array();
		var convCount = 0;
		var stringPosStart = 0;
		var stringPosEnd = 0;
		var matchPosEnd = 0;
		var newString = '';
		var match = null;
 
		while (match = exp.exec(string)) {
			if (match[9]) { convCount += 1; }
 
			stringPosStart = matchPosEnd;
			stringPosEnd = exp.lastIndex - match[0].length;
			strings[strings.length] = string.substring(stringPosStart, stringPosEnd);
 
			matchPosEnd = exp.lastIndex;
			matches[matches.length] = {
				match: match[0],
				left: match[3] ? true : false,
				sign: match[4] || '',
				pad: match[5] || ' ',
				min: match[6] || 0,
				precision: match[8],
				code: match[9] || '%',
				negative: parseInt(arguments[convCount]) < 0 ? true : false,
				argument: String(arguments[convCount])
			};
		}
		strings[strings.length] = string.substring(matchPosEnd);
 
		if (matches.length == 0) { return string; }
		if ((arguments.length - 1) < convCount) { return null; }
 
		var code = null;
		var match = null;
		var i = null;
 
		for (i=0; i<matches.length; i++) {
 
			if (matches[i].code == '%') { substitution = '%' }
			else if (matches[i].code == 'b') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(2));
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'c') {
				matches[i].argument = String(String.fromCharCode(parseInt(Math.abs(parseInt(matches[i].argument)))));
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'd') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 'f') {
				matches[i].argument = String(Math.abs(parseFloat(matches[i].argument)).toFixed(matches[i].precision ? matches[i].precision : 6));
				substitution = sprintfWrapper.convert(matches[i]).replace('.', ',');
			}
			else if (matches[i].code == 'o') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(8));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 's') {
				matches[i].argument = matches[i].argument.substring(0, matches[i].precision ? matches[i].precision : matches[i].argument.length)
				substitution = sprintfWrapper.convert(matches[i], true);
			}
			else if (matches[i].code == 'x') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16));
				substitution = sprintfWrapper.convert(matches[i]);
			}
			else if (matches[i].code == 'X') {
				matches[i].argument = String(Math.abs(parseInt(matches[i].argument)).toString(16));
				substitution = sprintfWrapper.convert(matches[i]).toUpperCase();
			}
			else {
				substitution = matches[i].match;
			}
 
			newString += strings[i];
			newString += substitution;
 
		}
		newString += strings[i];
 
		return newString;
 
	},
 
	convert : function(match, nosign){
		if (nosign) {
			match.sign = '';
		} else {
			match.sign = match.negative ? '-' : match.sign;
		}
		var l = match.min - match.argument.length + 1 - match.sign.length;
		var pad = new Array(l < 0 ? 0 : l).join(match.pad);
		if (!match.left) {
			if (match.pad == "0" || nosign) {
				return match.sign + pad + match.argument;
			} else {
				return pad + match.sign + match.argument;
			}
		} else {
			if (match.pad == "0" || nosign) {
				return match.sign + match.argument + pad.replace(/0/g, ' ');
			} else {
				return match.sign + match.argument + pad;
			}
		}
	}
}
 
sprintf = sprintfWrapper.init;