////////////////////////////////////////////////////////////////////////////////////
///// Ecard Opener /////
////////////////////////////////////////////////////////////////////////////////////

function ZeitraumKomplett() {
	var tourenFr = document.getElementById("FrTouren");
	var tourenSa = document.getElementById("SaTouren");
	
	if (tourenFr) { tourenFr.style.display='block'; tourenFr.style.visibility='visible'; }
	if (tourenSa) { tourenSa.style.display='block'; tourenSa.style.visibility='visible'; }
	
	var kompl2 = document.getElementById("divKon2ZeitraumKomplett");
	if (kompl2) { kompl2.style.display='block'; kompl2.style.visibility='visible'; }
	var sonntag2 = document.getElementById("divKon2ZeitraumSonntag");
	if (sonntag2) { sonntag2.style.display='none'; sonntag2.style.visibility='hidden'; }
	
	var kompl3 = document.getElementById("divKon3ZeitraumKomplett");
	if (kompl3) { kompl3.style.display='block'; kompl3.style.visibility='visible'; }
	var sonntag3 = document.getElementById("divKon3ZeitraumSonntag");
	if (sonntag3) { sonntag3.style.display='none'; sonntag3.style.visibility='hidden'; }
	
	var kompl4 = document.getElementById("divKon4ZeitraumKomplett");
	if (kompl4) { kompl4.style.display='block'; kompl4.style.visibility='visible'; }
	var sonntag4 = document.getElementById("divKon4ZeitraumSonntag");
	if (sonntag4) { sonntag4.style.display='none'; sonntag4.style.visibility='hidden'; }
	
	var kompl5 = document.getElementById("divKon5ZeitraumKomplett");
	if (kompl5) { kompl5.style.display='block'; kompl5.style.visibility='visible'; }
	var sonntag5 = document.getElementById("divKon5ZeitraumSonntag");
	if (sonntag5) { sonntag5.style.display='none'; sonntag5.style.visibility='hidden'; }
	
	var kompl6 = document.getElementById("divKon6ZeitraumKomplett");
	if (kompl6) { kompl6.style.display='block'; kompl6.style.visibility='visible'; }
	var sonntag6 = document.getElementById("divKon6ZeitraumSonntag");
	if (sonntag6) { sonntag6.style.display='none'; sonntag6.style.visibility='hidden'; }
	
	var kompl7 = document.getElementById("divKon7ZeitraumKomplett");
	if (kompl7) { kompl7.style.display='block'; kompl7.style.visibility='visible'; }
	var sonntag7 = document.getElementById("divKon7ZeitraumSonntag");
	if (sonntag7) { sonntag7.style.display='none'; sonntag7.style.visibility='hidden'; }
	
	var kompl8 = document.getElementById("divKon8ZeitraumKomplett");
	if (kompl8) { kompl8.style.display='block'; kompl8.style.visibility='visible'; }
	var sonntag8 = document.getElementById("divKon8ZeitraumSonntag");
	if (sonntag8) { sonntag8.style.display='none'; sonntag8.style.visibility='hidden'; }
}

function ZeitraumSonntag() {
	var tourenFr = document.getElementById("FrTouren");
	var tourenSa = document.getElementById("SaTouren");
	
	if (tourenFr) { tourenFr.style.display='none'; tourenFr.style.visibility='hidden'; }
	if (tourenSa) { tourenSa.style.display='none'; tourenSa.style.visibility='hidden'; }
	
	var kompl2 = document.getElementById("divKon2ZeitraumKomplett");
	if (kompl2) { kompl2.style.display='none'; kompl2.style.visibility='hidden'; }
	var sonntag2 = document.getElementById("divKon2ZeitraumSonntag");
	if (sonntag2) { sonntag2.style.display='block'; sonntag2.style.visibility='visible'; }
	
	var kompl3 = document.getElementById("divKon3ZeitraumKomplett");
	if (kompl3) { kompl3.style.display='none'; kompl3.style.visibility='hidden'; }
	var sonntag3 = document.getElementById("divKon3ZeitraumSonntag");
	if (sonntag3) { sonntag3.style.display='block'; sonntag3.style.visibility='visible'; }
	
	var kompl4 = document.getElementById("divKon4ZeitraumKomplett");
	if (kompl4) { kompl4.style.display='none'; kompl4.style.visibility='hidden'; }
	var sonntag4 = document.getElementById("divKon4ZeitraumSonntag");
	if (sonntag4) { sonntag4.style.display='block'; sonntag4.style.visibility='visible'; }
	
	var kompl5 = document.getElementById("divKon5ZeitraumKomplett");
	if (kompl5) { kompl5.style.display='none'; kompl5.style.visibility='hidden'; }
	var sonntag5 = document.getElementById("divKon5ZeitraumSonntag");
	if (sonntag5) { sonntag5.style.display='block'; sonntag5.style.visibility='visible'; }
	
	var kompl6 = document.getElementById("divKon6ZeitraumKomplett");
	if (kompl6) { kompl6.style.display='none'; kompl6.style.visibility='hidden'; }
	var sonntag6 = document.getElementById("divKon6ZeitraumSonntag");
	if (sonntag6) { sonntag6.style.display='block'; sonntag6.style.visibility='visible'; }
	
	var kompl7 = document.getElementById("divKon7ZeitraumKomplett");
	if (kompl7) { kompl7.style.display='none'; kompl7.style.visibility='hidden'; }
	var sonntag7 = document.getElementById("divKon7ZeitraumSonntag");
	if (sonntag7) { sonntag7.style.display='block'; sonntag7.style.visibility='visible'; }
	
	var kompl8 = document.getElementById("divKon8ZeitraumKomplett");
	if (kompl8) { kompl8.style.display='none'; kompl8.style.visibility='hidden'; }
	var sonntag8 = document.getElementById("divKon8ZeitraumSonntag");
	if (sonntag8) { sonntag8.style.display='block'; sonntag8.style.visibility='visible'; }
}

function ShowHidePersons() {
	var anzahlPersonen = document.getElementById("_ctl3__ctl0_anzPersonen");
	var ctrl;
	
	var anz = 0;
	
	if (anzahlPersonen) {
		anz = anzahlPersonen.options[anzahlPersonen.selectedIndex].value;
	}
	
	ctrl = document.getElementById("Person2");
	if (ctrl && anz < 2) {
		ctrl.style.display='none';
		ctrl.style.visibility='hidden';
	}
	else if (ctrl && anz >= 2) {
		ctrl.style.display='block';
		ctrl.style.visibility='visible';
	}
	
	ctrl = document.getElementById("Person3");
	if (ctrl && anz < 3) {
		ctrl.style.display='none';
		ctrl.style.visibility='hidden';
	}
	else if (ctrl && anz >= 3) {
		ctrl.style.display='block';
		ctrl.style.visibility='visible';
	}
	
	ctrl = document.getElementById("Person4");
	if (ctrl && anz < 4) {
		ctrl.style.display='none';
		ctrl.style.visibility='hidden';
	}
	else if (ctrl && anz >= 4) {
		ctrl.style.display='block';
		ctrl.style.visibility='visible';
	}
	
	ctrl = document.getElementById("Person5");
	if (ctrl && anz < 5) {
		ctrl.style.display='none';
		ctrl.style.visibility='hidden';
	}
	else if (ctrl && anz >= 5) {
		ctrl.style.display='block';
		ctrl.style.visibility='visible';
	}
	
	ctrl = document.getElementById("Person6");
	if (ctrl && anz < 6) {
		ctrl.style.display='none';
		ctrl.style.visibility='hidden';
	}
	else if (ctrl && anz >= 6) {
		ctrl.style.display='block';
		ctrl.style.visibility='visible';
	}
	
	ctrl = document.getElementById("Person7");
	if (ctrl && anz < 7) {
		ctrl.style.display='none';
		ctrl.style.visibility='hidden';
	}
	else if (ctrl && anz >= 7) {
		ctrl.style.display='block';
		ctrl.style.visibility='visible';
	}
	
	ctrl = document.getElementById("Person8");
	if (ctrl && anz < 8) {
		ctrl.style.display='none';
		ctrl.style.visibility='hidden';
	}
	else if (ctrl && anz >= 8) {
		ctrl.style.display='block';
		ctrl.style.visibility='visible';
	}
}

function openFlyoutSlideshow(flag, url, themaID, catID, card) {
		//nur für das statische alpin-layout
	
		win=window.open(url,'name',"width=812,height=600,resizeable=0,toolbar=no,scrollbars=1,status=0");
}


function openFlyoutImage (url, width, height) {
	var dest = "/home/news/" + document.getElementById("objectguid").firstChild.nodeValue + "?img=" + url + "&view=flyout&width="+width+"&height="+height;
	win=window.open(dest,'imageflyout',"'menubar=1 ,toolbar=0,scrollbars=0,status=0,resizable=0,height="+ height +",width=" + width + "'");
  return;
}

function openFlyoutImageRessort (url, res_url, width, height) {
	var dest = "/" + res_url + "/news/" + document.getElementById("objectguid").firstChild.nodeValue + "?img=" + url + "&view=flyout&width="+width+"&height="+height;
	win=window.open(dest,'imageflyout',"'menubar=1 ,toolbar=0,scrollbars=0,status=0,resizable=0,height="+ (parseInt(height)+110) +",width=" + (parseInt(width)+155) + "'");
	return;
}

function openWebcam(url, width, height, tourid) {
	var dest = "/tourentipps/news/?img=" + url + "&view=flyout&type=webcam&tourid=" + tourid + "&width="+width+"&height="+height;
	win=window.open(dest,'Tourentipps',"'menubar=1 ,toolbar=0,scrollbars=0,status=0,resizable=0,height="+ (parseInt(height)+125) +",width=" + (parseInt(width)+155) + "'");
	return;
	
	//win=window.open(url, titel, "'menubar=yes,toolbar=no,scrollbars=no,status=no,resizable=no,height="+ height +",width=" + width + "'");
}
function openWebcamRegion(url, width, height, regionid) {
	var dest = "/tourentipps/news/?img=" + url + "&view=flyout&type=webcam&regionid=" + regionid + "&width="+width+"&height="+height;
	win=window.open(dest,'Tourentipps',"'menubar=1 ,toolbar=0,scrollbars=0,status=0,resizable=0,height="+ (parseInt(height)+125) +",width=" + (parseInt(width)+155) + "'");
	return;
	
	//win=window.open(url, titel, "'menubar=yes,toolbar=no,scrollbars=no,status=no,resizable=no,height="+ height +",width=" + width + "'");
}

function openProductFlyoutImage (url, width, height) {
	var dest = "/home/news/" + document.getElementById("objectguid").firstChild.nodeValue + "?img=" + url + "&view=flyout&width="+width+"&height="+height+"&type=product";
	win=window.open(dest,'imageflyout',"'menubar=1 ,toolbar=0,scrollbars=0,status=0,resizable=0,height="+ height +",width=" + width + "'");
  return;
}


function openPrintView (url) {
	win=window.open(url,'printview');
  return;
}

function checkChoice(whichbox) {
	if (whichbox.checked == false)
		whichbox.form["heft_menge_" + whichbox.value].value = "0";
	else
		whichbox.form["heft_menge_" + whichbox.value].value = "1";
	return;
}

function checkTotal(of) {
	
	var totalAmount = of.form["total"].value;
		
	var somethingDone = false;
	
	for (var i=0;i<totalAmount;i++) {
	
		if ((of.form["heft_check_" + i].checked==true) && parseInt(of.form["heft_menge_"+i].value)>0) {
			somethingDone = true;
			break;
		}
	}
	
	if (somethingDone) {
		of.form.submit();
	}
	else
	{
		alert(unescape("Sie m%FCssen mindestens ein Heft ausw%E4hlen!"));
	}
		
	return;
}

function submitForm() {
	document.forms[0].submit()
}

function openEcardPopup(flag, url, themaID, catID, card) {

	var full_url, name;
	
	if (flag > 0)
	{
		name = 'alpinEcards'+ themaID;
		full_url = url + '&thema=' + themaID;
		
		if (card != '')
		{
			full_url = full_url + '&card=' + card;
		}
		else
		{
			full_url = full_url + '&cat=' + catID;
		}
		
		//alert('url: ' + full_url + '   name: ' + name);
	
		win=window.open(full_url,name,"width=985,height=750,resizeable=0,toolbar=no,scrollbars=0,status=0");
	}	
}

function openFotowettbewerbPopup() {
	win=window.open('/foto_wettbewerb/slidecard.aspx','Fotowettbewerb',"width=1024,height=700,resizeable=0,toolbar=no,scrollbars=0,status=0,top=20,left=20");	
}

function openFotowettbewerbFlyout(thema,cat) {
	win=window.open('/foto_wettbewerb/slidecard.aspx?app=5&thema=' + thema + '&cat=' + cat,'Fotowettbewerb',"width=1024,height=700,resizeable=0,toolbar=no,scrollbars=0,status=0,top=20,left=20");	
}


function SelectMonth(SelectCtrl, URL) {
	location.href=URL+'?SelMonth='+SelectCtrl.options[SelectCtrl.selectedIndex].value;
	return;
}

function sendDBsearch(myform){
	var startCtrl = document.getElementById("Start");
	var sCtrl = document.getElementById("S")
	var zielCtrl = document.getElementById("Z");
	
	sCtrl.value = encode_iso(startCtrl.value);
	zielCtrl.value = encode_iso(zielCtrl.value);
	
	myform.submit();
	
	return;
}

////iso-8859-1
////D6 = Ö
////=F6 = ö
////=C4 = Ä
////=DF = ß
////=E4 = ä
////=FC = ü
////=DC = Ü

function encode_iso(rohtext) {
    var utftext = "";
     
    rohtext = rohtext.replace(/\r\n/g,"\n");
       
    for(var n=0; n<rohtext.length; n++) {
		
		if (rohtext.charAt(n) == "\xE4") {
			utftext += "ae";
		}
		else if (rohtext.charAt(n) == "\xF6") {
			utftext += "oe";
		}
		else if (rohtext.charAt(n) == "\xFC") {
			utftext += "ue";
		}
		else if (rohtext.charAt(n) == "\xDF") {
			utftext += "ss";
		}
		else if (rohtext.charAt(n) == "\xC4") {
			utftext += "Ae";
		}
		else if (rohtext.charAt(n) == "\xD6") {
			utftext += "Oe";
		}
		else if (rohtext.charAt(n) == "\xDC") {
			utftext += "Ue";
		}
		else if (rohtext.charAt(n) == "ä") {
			utftext += "ae";
		}
		else if (rohtext.charAt(n) == "ö") {
			utftext += "oe";
		}
		else if (rohtext.charAt(n) == "ü") {
			utftext += "ue";
		}
		else if (rohtext.charAt(n) == "ß") {
			utftext += "ss";
		}
		else if (rohtext.charAt(n) == "Ä") {
			utftext += "Ae";
		}
		else if (rohtext.charAt(n) == "Ö") {
			utftext += "Oe";
		}
		else if (rohtext.charAt(n) == "Ü") {
			utftext += "Ue";
		}
		else {
			utftext += rohtext.charAt(n);
		}
	}	
    return utftext;
}


// ---------------------------------------------------------------------------
// Tooltip

/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

// ---------------------------------------------------------------------------
var portalurl2 = "";
// ---------------------------------------------------------------------------

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="http://mediadb.alpin.de/library/images/tooltipbox.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function Browser () 
{
	this.isIE = false;
	this.isNS = false;
	this.isOpera = false;
	this.isMozilla = false;
	this.isWin = false;
	this.isMac = false;
	this.isLinux = false;
	this.version = 0;
	this.isFlashed = false;
	var requiredFlashVersion = 6;
	var maxFlashVersion = 10;
	var agent = navigator.userAgent.toLowerCase ();
	this.isIE = agent.indexOf ("msie") != -1 && agent.indexOf ("opera") == -1;
	this.isNS = (agent.indexOf ("netscape") != -1 || navigator.appName == "Netscape") && agent.indexOf ("opera") == -1;
	//in netscape4 "netscape" doesn't appear in navigator.userAgent
	this.isOpera = agent.indexOf ("opera") != -1;
	this.isMozilla = agent.indexOf ("mozilla") != -1;
	this.isKonqueror = agent.indexOf ("konqueror") != -1;
	this.isWin = agent.indexOf ("win") != -1;
	this.isMac = agent.indexOf ("mac") != -1;
	this.isLinux = agent.indexOf ("linux") != -1;
	var minor = parseFloat (navigator.appVersion);
	if (this.isNS) 
	{
	if (minor >= 6) {
	this.version = 6;
	} else {
	this.version = minor;	}
	} else if (this.isKonqueror) {
	this.version = minor;
	} else if (this.isIE) {
	if (agent.indexOf ("msie 5") != -1 && minor == 4) {
	this.version = 5;
	} else {
	this.version = minor;
	}
	} else if (this.isOpera) {
	if (agent.indexOf ("opera 2") != -1 || agent.indexOf ("opera/2") != -1) {
	this.version = 2;
	}
	if (agent.indexOf ("opera 3") != -1 || agent.indexOf ("opera/3") != -1) {
	this.version = 3;
	}
	if (agent.indexOf ("opera 4") != -1 || agent.indexOf ("opera/4") != -1) {
	this.version = 4;
	}
	if (agent.indexOf ("opera 5") != -1 || agent.indexOf ("opera/5") != -1) {
	this.version = 5;
	}
	if (agent.indexOf ("opera 6") != -1 || agent.indexOf ("opera/6") != -1) {
	this.version = 6;
	}
	}
	if (this.isIE && this.isWin) {
	document.write ('<SCR' + 'IPT LANGUAGE="VBScript" \> \n');
	document.write ('on error resume next \n');
	for (i = requiredFlashVersion; i < maxFlashVersion + 1; i++) {
	document.write ('flash' + i + 'Installed = false \n');
	document.write ('flash' + i + 'Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + i + '"))) \n');
	}
	document.write ('</SCR' + 'IPT\> \n');
	for (i = requiredFlashVersion; i < maxFlashVersion + 1; i++) {
	if (eval ("flash" + i + "Installed")) {
	this.isFlashed = true;
	break;
	}
	}
	} else if (navigator.plugins && navigator.plugins["Shockwave Flash"]) {
	var plugin = navigator.plugins["Shockwave Flash"];
	var currVersion = plugin.description.charAt (plugin.description.indexOf (".") - 2);
	
	if (currVersion > 0) {
		currVersion = currVersion + plugin.description.charAt (plugin.description.indexOf (".") - 1);
	}
	else
		currVersion = plugin.description.charAt (plugin.description.indexOf (".") - 1);
	
	this.isFlashed = (currVersion >= requiredFlashVersion);
	}
}
var myBrowser = new Browser();


///* ----------------------------------------------------------------*/
///* Videoplayer ----------------------------------------------------*/
///* ----------------------------------------------------------------*/
//var local_string = "http://" + window.location.hostname;
//if(window.location.port!=""){local_string+=":"+window.location.port}
//var videoPath = 'http://video.alpin.de/flash/';
//var playlistURL = local_string+'/videoplaylist';
//var videoPlayer = 'http://mediadb.alpin.de/library/videoplayer/popupPlayerWide.swf';
//var player169URL = 'http://mediadb.alpin.de/library/videoplayer/smallPlayerWide.swf';
////var videoPlayer = 'http://www.kicker.de/flash/popupPlayerWide.swf';
////var player169URL = 'http://www.kicker.de/flash/smallPlayerWide.swf';

//var ovOAS_timeseen_url = '';
//var ovOAS_current_timeseen = -1;

//function ovOAS_timeseen(seconds) { ovOAS_current_timeseen = seconds; }
//function ovSetOAS_timeseen_url(url) { ovOAS_timeseen_url = url; }

//function ovOAS_timeseen_onunload() {
//	if (ovOAS_current_timeseen >= 0 && ovOAS_current_timeseen < 999)
//	{
//		if (ovOAS_timeseen_url && ovOAS_timeseen_url != '')
//		{
//			document.write('<img src="' + ovOAS_timeseen_url.replace("\[sekunden.gif\]", ovOAS_current_timeseen + ".gif") + '" border="0" width="1" height="1">');

//			ovOAS_finaltime = (new Date).getTime() + 500;
//			while ((new Date).getTime() < ovOAS_finaltime)
//			{
//			}
//		}
//	}
//}

//function ovOAS_reminder(html)
//{
//	if ((html != null) && (html != 'null')) { 
//		document.getElementById('reminder').innerHTML = html; 
//    }
//}

//function ovLoadFlashVideo(videoceid, flashvars, divelement)
//{
//	var divs = divelement.getElementsByTagName('DIV');
//	for (key=0; key < divs.length; key++) {
//		eval('ovLoadFlashvideoElement'+divs[key].className+' = divs[key]');
//	}
// 
//    var playerURL = player169URL;
//    
//	flashvars += 'FlashVars_videoPath=http://video.alpin.de/flash/&'; 
//	flashvars += 'FlashVars_brand=Alpin&'; 
//	flashvars += 'FlashVars_language=de&'; 
//	flashvars += 'FlashVars_adServerXmlPath=http://adserv.quality-channel.de/RealMedia/ads/adstream_sx.ads/www.kicker.de/[CATEGORY]/[RANDOM]@[POSITION]&';
//	flashvars += 'FlashVars_countURL=' + escape(local_string+'/videocount?id=[ID]&format=[FORMAT]') + '&'; 
//	flashvars += 'FlashVars_countFrame=qc_count_frame&'; 
//	flashvars += 'FlashVars_JS_setOAS_timeseen_url=ovSetOAS_timeseen_url&'; 
//	flashvars += 'FlashVars_JS_OAS_timeseen=ovOAS_timeseen&'; 
//	flashvars += 'FlashVars_JS_OAS_reminder=ovOAS_reminder&'; 
//	flashvars += 'FlashVars_JS_openPopup=ovOpenPopupPlayer&'; 
//	flashvars += 'FlashVars_JS_showFlashDiv=ovShowFlashVideoDiv'; 
//	
//	if (document.getElementById){		
//		ovLoadFlashvideoElementvideoMovie.innerHTML = '<div style="background-color:#ffffff;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+videoceid+'" width="180" height="155">\n<param name="movie" value="' + playerURL + '" />\n<param name="quality" value="high" />\n<param name="bgcolor" value="#f2f2f2" />\n<param name="menu" value="false" />\n<param name="allowScriptAccess" value="always" />\n<param name="wmode" value="transparent">\n<param name="FlashVars" value="'+flashvars+'" />\n<embed src="'+playerURL+'" name="'+videoceid+'" type="application/x-shockwave-flash" width="180" height="155" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" bgcolor="#f2f2f2" menu="false" allowScriptAccess="always" FlashVars="'+flashvars+'" wmode="transparent"><\/embed>\n<\/object></div>\n';		
//	}
//}

//function ovShowFlashVideoDiv(videoceid)
//{
//	ovLoadFlashvideoElementvideoMovie.style.zIndex=3;	
//}

//function ovOpenPopupPlayer(videoid)
//{
//	window.location.href = local_string+'/filme/video?videoid=' + videoid;
//}

//function ovCreatePopupPlayer(videoid, category, allowAds, thema, headline, credit)
//{	
//	var flashVars = '';

//	// erstes Video
//	if (videoid != null)
//	{
//		flashVars += 'FlashVars_videoid=' + videoid + '&';
//		flashVars += 'FlashVars_category=' + category + '&';
//		flashVars += 'FlashVars_allowAds=' + allowAds + '&';
//		flashVars += 'FlashVars_thema=' + encodeURI(thema) + '&';
//		flashVars += 'FlashVars_headline=' + encodeURI(headline) + '&';
//		flashVars += 'FlashVars_credit=' + credit + '&';
//	}

//	// ******************************************************************
//	// allgemein
//	flashVars += 'FlashVars_logLevel=QUIET&';
//	flashVars += 'FlashVars_language=de&';

//	flashVars += 'FlashVars_videoPath='+videoPath+'&';
//	flashVars += 'FlashVars_playlistUrl='+playlistURL+'?&';
//	
//	flashVars += 'FlashVars_playlistUrlSeparator=%26&';
//	flashVars += 'FlashVars_enableVideoSending=false&';
//	
//	// AdServer (XML für VideoAd-Schaltung) - Prod
//	flashVars += 'FlashVars_adServerXmlPath=http://adserv.quality-channel.de/RealMedia/ads/adstream_sx.ads/www.kicker.de/[CATEGORY]/[RANDOM]@[POSITION]&';

//	// Statistik	
//	flashVars += 'FlashVars_countURL='+escape(local_string+'/videocount?id=[ID]&format=[FORMAT]') + '&'; 
//		
//	flashVars += 'FlashVars_countFrame=qc_count_frame&'; 
//	
//	// Hinweis-URL f&uuml;r Fullscreen
//	flashVars += 'FlashVars_fullscreenHintUrl=/newsarchiv/news/1831a743-f79e-4e47-8b58-5eb656f4d37e&';

//	// JavaScript-Funktionen
//	flashVars += 'FlashVars_JS_setOAS_timeseen_url=ovSetOAS_timeseen_url&'; 
//	flashVars += 'FlashVars_JS_OAS_timeseen=ovOAS_timeseen&'; 
//	flashVars += 'FlashVars_JS_OAS_reminder=ovOAS_reminder&'; 
//	flashVars += 'FlashVars_JS_openPopup=ovOpenPopupPlayer&'; 

//	// Logo und Farben
//	flashVars += 'FlashVars_brand_text=kicker&';
//	flashVars += 'FlashVars_logourl=http://mediadb.alpin.de/library/images/s.gif&';

//	flashVars += 'FlashVars_color_main=666666&';
//	flashVars += 'FlashVars_color_channel_active=cc0000&';
//	flashVars += 'FlashVars_color_thema=225577&';
//	flashVars += 'FlashVars_color_headline=363535&';
//	flashVars += 'FlashVars_color_date=595959&';
//	flashVars += 'FlashVars_color_credit=363535&';
//	flashVars += 'FlashVars_color_vid_active=e9e9e9&';
//	flashVars += 'FlashVars_color_vid_over=f3f3f3&';
//	flashVars += 'FlashVars_color_btn_article=1E3B6B&'; 
//	flashVars += 'FlashVars_color_btn_send=1E3B6B&'; 
//	flashVars += 'FlashVars_color_top_background=ffffff&';
//	flashVars += 'FlashVars_color_top_line=8b8a8a&';
//	flashVars += 'FlashVars_color_top_text=ffffff&';
//	flashVars += 'FlashVars_color_videoheadline=ffffff&';
//	flashVars += 'FlashVars_color_videobackground=a6a6a6&';
//	flashVars += 'FlashVars_show_channel_gradient=false&';
//	
//	// List: Tabs
////	flashVars += 'FlashVars_tabnames=Neueste;St&ouml;bern;Suchen&';
////	flashVars += 'FlashVars_tabmodes=url;browse;search&';
////	flashVars += 'FlashVars_tabstyles=norm;fold;fold&';
////	flashVars += 'FlashVars_urls='+playlistURL+'?mode=newest;null;null&';
////	flashVars += 'FlashVars_categories=Alle,News,EM,Dt. Fussball&';
//	flashVars += 'FlashVars_tabnames=Neueste;Suchen&';
//	flashVars += 'FlashVars_tabmodes=url;search&';
//	flashVars += 'FlashVars_tabstyles=norm;fold&';
//	flashVars += 'FlashVars_urls='+playlistURL+'?mode=newest;null&';
//			
//	// Erzwingung eines 16:9 Playback-Bereichs bereits bei der Initialisierung des Players
//	flashVars += 'FlashVars_forceWideScreen=true&';	
//	// Sofern forceWideScreen=false: 4:3 Playback-Bereich wird zentriert
//	flashVars += 'FlashVars_centerComponent=false&';

//	if(navigator.userAgent.indexOf("IE")>=0) {
//		document.getElementById('ovPopupPlayer').innerHTML = '<embed src="'+videoPlayer+'" name="flashVideoPlayer" type="application/x-shockwave-flash" width="909" height="415" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" bgcolor="#d9d9d9" menu="false" allowScriptAccess="always" FlashVars="'+flashVars+'" wmode="opaque"><\/embed>';
//	}else{
//		document.getElementById('ovPopupPlayer').innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="flashVideoPlayer" width="909" height="415">\n<param name="movie" value="' + videoPlayer + '" />\n<param name="quality" value="high" />\n<param name="bgcolor" value="#d9d9d9" />\n<param name="menu" value="false" />\n<param name="allowScriptAccess" value="always" />\n<param name="wmode" value="opaque">\n<param name="FlashVars" value="'+flashVars+'" />\n<embed src="'+videoPlayer+'" name="flashVideoPlayer" type="application/x-shockwave-flash" width="909" height="415" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" bgcolor="#d9d9d9" menu="false" allowScriptAccess="always" FlashVars="'+flashVars+'" wmode="opaque"><\/embed>\n<\/object>';
//	}
//}

// ---------------------------------------------------------------------------
// FlashVideo
// ---------------------------------------------------------------------------

var local_string = "http://" + window.location.hostname;
if(window.location.port!=""){local_string+=":"+window.location.port}
var videoPath = 'http://video.alpin.de/flash/';
var playlistURL = '/videoplaylist';
var videoPlayer = 'http://mediadb.alpin.de/library/videoplayer/kickerplayer43_2.swf';
//var videoPlayer = '/flash/kickerplayer43_2.swf';
var player169URL = 'http://mediadb.alpin.de/library/videoplayer/smallPlayerWide.swf';

var myListener = {};
var kickerPlayer = {};

function updateHTML(elmId, value)
{
   document.getElementById(elmId).innerHTML = value;
}	   

function setytplayerState(newState)
{
   updateHTML("playerstate", newState);
}
	   
function onKickerPlayerReady(playerId)
{
    kickerPlayer = document.getElementById("flashVideoPlayer");

    kickerPlayer.addEventListener("onLoad", "myListener.onLoad");
    kickerPlayer.addEventListener("onPlay", "myListener.onPlay");
    kickerPlayer.addEventListener("onPause", "myListener.onPause");
    kickerPlayer.addEventListener("onComplete", "myListener.onComplete");			    
}

function play()
{
   kickerPlayer.playVideo();
}
function pause()
{
   kickerPlayer.pauseVideo();
}

myListener.onLoad = function(receivedParamsFromPlayerIfAny)
{
   setytplayerState(receivedParamsFromPlayerIfAny);
}
myListener.onPlay = function(receivedParamsFromPlayerIfAny)
{
   setytplayerState(receivedParamsFromPlayerIfAny);
}
myListener.onPause = function(receivedParamsFromPlayerIfAny)
{
   setytplayerState(receivedParamsFromPlayerIfAny);
}
myListener.onComplete = function(receivedParamsFromPlayerIfAny)
{
   setytplayerState(receivedParamsFromPlayerIfAny);
}

function ovCreatePopupPlayer(videoid, category, allowAds, thema, headline, credit, videoLevelId, videoStreamingUrl)
{
	var flashvars = '';
	var ewtest = (document.URL.indexOf("ewtest")>-1);
	//initialClip -> if not defined the player will use the first clip out of the Playlist
	flashvars += 'FlashVars_videoid='+ videoid + '&';
	flashvars += 'FlashVars_category='+category + '&';
	flashvars += 'FlashVars_allowInitialAds='+allowAds + '&'; //only for the initial-clip'
	flashvars += 'FlashVars_thema='+encodeURI(thema) + '&';
	flashvars += 'FlashVars_headline='+encodeURI(headline) + '&';
	flashvars += 'FlashVars_credit=' + credit + '&';
	flashvars += 'FlashVars_videolevelid=' + videoLevelId + '&';
	flashvars += 'FlashVars_streamingurl=' + videoStreamingUrl + '&';
	
	flashvars += 'FlashVars_baseURL=http://www.alpin.de&';
	flashvars += 'FlashVars_loglevel=LEVEL_NONE&'; //allowed: LEVEL_NONE, LEVEL_DEBUG, LEVEL_INFO
	
	flashvars += 'FlashVars_allowAds=true' + '&';
	if (ewtest){
	    flashvars += 'FlashVars_allowLCAds=false' + '&';
	}else{
	    flashvars += 'FlashVars_allowLCAds=true' + '&';
	}
	flashvars += 'FlashVars_allowEWAds=true' + '&';
	flashvars += 'FlashVars_urls='+playlistURL+'?mode=newest;null&';
	flashvars += 'FlashVars_playlistUrl='+playlistURL+'?&';
	
	// Statistik	
	flashvars += 'FlashVars_countURL='+escape(local_string+'/videocount?id=[ID]&format=[FORMAT]') + '&'; 
	flashvars += 'FlashVars_countFrame=ad_count_frame&'; 
	
	flashvars += 'FlashVars_categories=Alle,Spitzen-Bergsport,Trailer&';
	flashvars += 'FlashVars_showCategory=true&';
//	flashvars += 'FlashVars_tabnames=Neueste&';
//	flashvars += 'FlashVars_tabmodes=url;search&';
//	flashvars += 'FlashVars_tabstyles=norm;fold&';
	
	flashvars += 'FlashVars_videoPath='+videoPath + '&';
	flashvars += 'FlashVars_lc_networkId=106414' + '&';
	flashvars += 'FlashVars_lc_format=Video-Flash-400-400x300' + '&';
	flashvars += 'FlashVars_lc_levelId=Alpin_Portal%3AAlpin_Gesamt' + '&';
	flashvars += 'FlashVars_lc_displayRegion=Standartbanner' + '&';
		
	if (ewtest){
	    //Test	
       flashvars += 'FlashVars_ew_url=http://ad.de.doubleclick.net/adx/testadvertiser.smartclip/complete;sz=400x320;dcmt=text/html;ord=[timestamp]?' + '&';
        flashvars += 'FlashVars_ew_overlay_url=http://ad.de.doubleclick.net/adx/testadvertiser.smartclip/complete;sz=300x50;dcmt=text/html;ord=[timestamp]?' + '&';
        flashvars += 'FlashVars_ew_mid_url=http://ad.de.doubleclick.net/adx/testadvertiser.smartclip/complete;sz=400x299;dcmt=text/html;ord=[timestamp]?' + '&';
        flashvars += 'FlashVars_ew_post_url=http://ad.de.doubleclick.net/adx/testadvertiser.smartclip/complete;sz=400x300;dcmt=text/html;ord=[timestamp]?' + '&';	
	}else{
	    //Live
	     flashvars += 'FlashVars_ew_url=http://ad.de.doubleclick.net/ad/alpinde.smartclip/;sz=400x320;dcmt=text/xml;ord=[random]?' + '&';
        flashvars += 'FlashVars_ew_overlay_url=http://ad.de.doubleclick.net/ad/alpinde.smartclip/;sz=300x50;dcmt=text/xml;ord=[random]?' + '&';
        flashvars += 'FlashVars_ew_mid_url=http://ad.de.doubleclick.net/ad/alpinde.smartclip/;sz=400x299;dcmt=text/xml;ord=[random]?' + '&';
        flashvars += 'FlashVars_ew_post_url=http://ad.de.doubleclick.net/ad/alpinde.smartclip/;sz=400x300;dcmt=text/xml;ord=[random]?' + '&';	
    }
	
    //ew params
    flashvars += 'FlashVars_midroll_video_length=90' + '&';
    flashvars += 'FlashVars_overlayLoadDelay=3000';
    
    var params = {};
	params.allowfullscreen = "true";
	var attributes = { id: "kickerplayer" };
		
	if(navigator.userAgent.indexOf("iPad")>=0)//|| navigator.userAgent.indexOf("Safari")>=0) 
	{
	    var html5player = "<div class=\"ovVideoHTML5Wrapper\"><div class=\"ovVideoHTML5Headline\"><span>"+headline+"</span></div>";
	    html5player += "<video src=\"http://video.alpin.de/flash/"+videoid+"_996x560_H264_1400.mp4\" width=\"640\" height=\"360\" autoplay=\"true\" controls=\"controls\" >";
        html5player += "This browser is not compatible with HTML 5";
        html5player += "</video></div>";
	
	    document.getElementById('ovPopupPlayer').innerHTML = html5player;
	    var videoCountUrl = ovToolkit.rootURL+'/news/videocount?id='+videoid+'&format=ipad';
	    document.getElementById('ad_count_frame').src = videoCountUrl;
	}
	else if(navigator.userAgent.indexOf("IE")>=0) {
		document.getElementById('ovPopupPlayer').innerHTML = '<embed src="'+videoPlayer+'" name="flashVideoPlayer" id="flashVideoPlayer" type="application/x-shockwave-flash" width="909" height="381" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" bgcolor="#000000" menu="false" allowScriptAccess="always" allowFullScreen="true" FlashVars="'+flashvars+'" wmode="opaque"><\/embed>';
	}else{
		document.getElementById('ovPopupPlayer').innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="flashVideoPlayer" width="909" height="381">\n<param name="movie" value="' + videoPlayer + '" />\n<param name="quality" value="high" />\n<param name="bgcolor" value="#000000" />\n<param name="menu" value="false" />\n<param name="allowScriptAccess" value="always" />\n<param name="allowFullScreen" value="true" />\n<param name="wmode" value="opaque">\n<param name="FlashVars" value="'+flashvars+'" />\n<embed src="'+videoPlayer+'" name="flashVideoPlayer" type="application/x-shockwave-flash" width="909" height="381" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" bgcolor="#000000" menu="false" allowScriptAccess="always" allowFullScreen="true" FlashVars="'+flashvars+'" wmode="opaque"><\/embed>\n<\/object>';
	}
}

// ---------------------------------------------------------------------------
//GoogleAd
// ---------------------------------------------------------------------------
function google_ad_request_done(google_ads) {
	var s = '';
	var i;
	
	if (google_ads.length == 0) {
		return;
	}

	if (google_ads[0].type == "image") {
		s += '<a target="_blank" href=\"' +
		google_info.feedback_url + '\" style="color:000000">Google-Anzeigen</a><br> <a target="_blank" href="' +
		google_ads[0].url + '" target="_top" title="go to ' +
		google_ads[0].visible_url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
		google_ads[0].visible_url + '\';return true"><img class="googleimage" border="0" src="' +
		google_ads[0].image_url + '"width="' +
		google_ads[0].image_width + '"height="' +
		google_ads[0].image_height + '"></a><br style="clear:both;">';
	} 
	else {
		s += '<a target="_blank" href=\"' + google_info.feedback_url + '\" style="color:000000">Google-Anzeigen</a><br><div class="googletextborder">';
		
		if (google_ads.length == 1) {
			s += ' <a class="googletext" target="_blank" href="' +
			google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
			google_ads[0].visible_url + '\';return true"> <span style="text-decoration:underline;font-size:20pt"> <b>' +
			google_ads[0].line1 + '</b><br></span></a> <span style="color:#000000;font-size:16pt">' +
			google_ads[0].line2 + '&nbsp;' +
			google_ads[0].line3 + '<br></span> <span><a class="googletextlink" target="_blank" href="' +
			google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
			google_ads[0].visible_url + '\';return true">' +
			google_ads[0].visible_url + '</span></a><br>';
		} 
		else if (google_ads.length > 1) {
			for(i = 0; i < google_ads.length; ++i) {
				s += '<div><a class="googletext" target="_blank" href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true"> <span style="text-decoration:underline"> <b>' +
				google_ads[i].line1 + '</b><br></span></a> <span style="color:#000000">' +
				google_ads[i].line2 + '<br>' +
				google_ads[i].line3 + '<br></span> <span><a class="googletextlink" target="_blank" href="' +
				google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
				google_ads[i].visible_url + '\';return true">' +
				google_ads[i].visible_url + '</span></a><br><br></div>';
			}
		}
		
		s += '</div><br style="clear:both;">';
	}

	document.write(s);
	return;
}
