/* ------------------------ E I N S T E L L U N G E N ------------------------ */
path_fullscreen = "../fullscreen/";
img_name = "staudacher_";
parent.RoomTip = "Der Zimmerplan stellt ein Wohnbeispiel dar.";

/* ------------------------ Flashkarte ------------------------ */

function FlashLoaded(){
    parent.FlashIsLoaded = 1;
}

function FlashUnLoaded(){
    parent.FlashIsLoaded = 0;
}

function objFlash()
{
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' 	codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='430' height='293' id='map360' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='FlashVars' value='hotSpotId=" + parent.bild + "' /><param name='movie' value='map360.swf' /><param name='menu' value='false' /><param name='quality' value='high' /><param name='bgcolor' value='#85002b' /><embed src='map360.swf' menu='false' FlashVars='hotSpotId=" + parent.bild + "' quality='high' bgcolor='#85002b' width='430' height='293' name='map360' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>");
}

function zeige(n)
{
	if(parent.FlashIsLoaded)
	{
		//maps[0] = new Array('Standpunkt','Hotspot','0','Hotspot','2');
        maps = new Array();
        maps[0] = new Array('4494','4486','0');
        maps[1] = new Array('4486','4494','0');
        maps[2] = new Array('4898','4891','0','4880','2');
        maps[3] = new Array('4891','4880','0','4898','2');
        maps[4] = new Array('4880','4836','0','4814','2','4822','4','4829','6','4898','8','4891','10');
        maps[5] = new Array('4836','4880','0');
        maps[6] = new Array('4829','4880','0');
        maps[7] = new Array('4822','4880','0');
        maps[8] = new Array('4814','4880','0');
        maps[9] = new Array('4767','4880','0');
        maps[10] = new Array('4934','4843','0','4851','2','4858','4','4866','6','4926','8','4918','10');
        maps[11] = new Array('4926','4918','0','4934','2');
        maps[12] = new Array('4918','4866','0','4934','2','4910','4','4926','6');
        maps[13] = new Array('4910','4866','0','4934','2','4918','4');
        maps[14] = new Array('4866','4934','0');
        maps[15] = new Array('4858','4934','0');
        maps[16] = new Array('4851','4934','0');
        maps[17] = new Array('4843','4934','0');

        for(var index = 0; index < maps.length; index++)
        {
            for(var index1 = 0; index1 < maps[index].length; index1++)
            {
                if(parent.bild==maps[index][0] && n==maps[index][index1])
                {
					n = maps[index][index1 - 1];
                }
            }
        }

		if (n != -1) {
			parent.rechts.targetHotSpot(n);
		}
		else
		{
			parent.rechts.detargetHotSpot();
		}
	}
}

function getview(p)
{
	if(parent.FlashIsLoaded)
	{
	    rp=round2dec(p);
		parent.rechts.rotateArc(rp);
	}
}

function round2dec(value)
{
    return ((Math.round( 100 * value ))/100);
}


/* ------------------------ E - C A R D ------------------------ */
function open_ecard(x)
{
	stopPano();
	parent.rechts.location.href = "../ecard/ecard_de.php?bildnr=" + x;
}

/* ------------------------ B E T R I E B S S Y S T E M ------------------------ */

var os;

function identOs()
{
    var agent;
    agent = navigator.userAgent;
    if (agent.search(/Windows.+/)) 	os = "Windows";
    else if (agent.search(/Mac.+/)) 	os = "Mac OS";
    else if (agent.search(/Linux.+/)) 	os = "Linux";
    return os;
}

os = new identOs();

/* ------------------------ B R O W S E R ------------------------ */

var brw;

function identBrw()
{
	var agent;
    agent = navigator.userAgent;
	if (agent.search(/Gecko.+/)!=-1)
	{
		brw = "Mozilla";
	}
	else
	{
		if (agent.search(/Opera.+/)!=-1)
		{
			brw = "Opera";
		}
		else
		{
			brw = "Internet Explorer";
		}
	}


	return brw;
}

brw = new identBrw();

identBrw();
identOs();

//Panorama stoppen
function stopPano()
{
	if(parent.pano.document.getElementById('ptv'))
	{
		parent.pano.document.getElementById('ptv').stopAutoPan();
	}

}

/* ------------------------ F U L L S C R E E N ------------------------ */
var qtversion;
    qtversion=0;
var qtpresent;
    qtpresent=0;
var qthex;
tmp = new Array();

function open_fullscreen(bildnr)
{
	//Pfad basteln
	url = path_fullscreen + img_name + bildnr + '.html';

	stopPano();

    //fuer Mozilla´s
    if(brw == "Mozilla" || brw == "Opera")
    {
      for (i=0; i < navigator.plugins.length; i++ )
      {
          if (navigator.plugins[i].name.indexOf("QuickTime") >= 0)
          {
            parent.qtpresent = 1;
            parent.qtversion = navigator.plugins[i].name.substr(18,1);
          }
      }
    }

	//Fullscreen oeffnen
    if(parent.qtpresent==1)
    {
        if(parent.qtversion>4)
        {
           my = window.open(url,'Panoramabild','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0');
           my.focus();
        }//if
        else
        {
            check=confirm("Quicktime-Version " + parent.qtversion + " installiert. Sie benötigen min. Version 5. \nWollen Sie kostenfrei die aktuellste Version laden?");
            if(check==true) window.open("http://www.apple.com/de/quicktime/download/standalone.html");
        }//else

    }//if
    else
    {
        check=confirm("Sie haben kein Quicktime installiert. \nWollen Sie kostenfrei die aktuellste Version laden?");
        if(check==true) window.open("http://www.apple.com/de/quicktime/download/standalone.html");
    }//else
}//open_fullscreen

/* QTVR-Version in Int wandeln, nur fuer den MSIE */
function getVersion(dec){
  var dec;
  var index = 0;
  while(dec!=0){
    tmp[index] = parseInt(dec)%16;
    dec = parseInt(dec)/16;
    tmp[index] = dec;
    index++;
  }
  return tmp[5];
}

/* ------------------------ J A V A - P L U G I N ------------------------ */

var javapresent;
    javapresent=false;

var javaon;
    javaon=false;

function checkJava()
{
    if(brw=="Mozilla")
    {
        if (navigator.plugins)
        {
            for(i=0;i<navigator.plugins.length;i++)
            {
                if (navigator.plugins[i].name.indexOf("Java")>=0) javapresent=true;
            }
        }

        if (navigator.javaEnabled()) javaon=true;

        if (javapresent==false)
        {
            check=confirm("Konnte fuer die Panoramadarstellung kein Java-Plugin finden.\nJava-Plugin jetzt laden?");
            if(check==true) window.open("http://www.java.com/en/download/download_the_latest.jsp");
        }

        if (javaon==false && javapresent==true) alert("Java-Plugin wahrscheinlich deaktiviert.\nAktivieren Sie Java fuer eine korrekte Panoramadarstellung.");
    }

    if(brw=="Internet Explorer")
    {
        if (!navigator.javaEnabled())
        {
                check=confirm("Konnte kein Java-Plugin finden oder deaktiviert.\nJava-Plugin jetzt laden?");
                if(check==true) window.open("http://www.java.com/en/download/download_the_latest.jsp");
         }
    }
}
/* ------------------------ P A N O R A M A  ------------------------ */
function down(){
	parent.pano.document.ptv.startAutoPan(0,-0.3,1.0);
}
function up(){
	parent.pano.document.ptv.startAutoPan(0,0.3,1.0);
}
function left(){
	parent.pano.document.ptv.startAutoPan(-0.1,0,1.0);
}
function right(){
	parent.pano.document.ptv.startAutoPan(0.1,0,1.0);
}
/* ------------------------ Template  ------------------------ */
function tmpl_down(){
	document.ptv.startAutoPan(0,-0.3,1.0);
}
function tmpl_up(){
	document.ptv.startAutoPan(0,0.3,1.0);
}
function tmpl_left(){
	document.ptv.startAutoPan(-0.1,0,1.0);
}
function tmpl_right(){
	document.ptv.startAutoPan(0.1,0,1.0);
}

/* ------------------------ S C R O L L D O W N M E N U ------------------------ */
function DropDownMenu(x)
{
    if(x == "nothing")
    {
        document.forms[0].reset();
        document.forms[0].elements[0].blur();
        return;
    }
    else
    {
        parent.frames[1].location.href = x;
        document.forms[0].reset();
        document.forms[0].elements[0].blur();
    }
}


/* ------------------------ K A R T E  positionieren ------------------------ */
maps = new Array();

//Uebersichtskarten: Bezeichnung, Bildnummer, ...    eintragen
maps[0] = new Array('map_dz_1','4494','4486');
maps[1] = new Array('map_dz_2','4516','4505');
maps[2] = new Array('map_alpspitz','4898','4891','4880','4836','4829','4822','4814','4767');
maps[3] = new Array('map_zugspitze','4934','4926','4918','4910','4866','4858','4851','4843');

function plan()
{
	var map_isset = 0;

    for(var index = 0; index < maps.length; index++)
    {
        for(var index1 = 0; index1 < maps[index].length; index1++)
        {
			if(parent.bild==maps[index][index1])
			{
				parent.rechts.location.href = "../deutsch/" + maps[index][0] + "/" + maps[index][0] + ".html";
				parent.map = maps[index][0];
				map_isset = 1;
			}
        }
    }
    if(!map_isset)
    {
	    parent.rechts.location.href = "../deutsch/rechts.html";
    }
}

/* ------------------------ Ü B E R S I C H T S K A R T E laden------------------------ */
function loadOverview()
{
	parent.rechts.location.href = "../deutsch/rechts.html";
}
/* ------------------------ E C A R D  E I N G A B E N P R U E F U N G------------------------ */
  var delFoc,err1,err2,err3,err4;
  err1=1;
  err2=1;
  err3=1;
  err4=1;

  function err_code(){

  	if (window.document.forms[0].absendername.value == "") {
   		document.getElementById("vr_err").firstChild.nodeValue = "Diese Angabe * bitte eintragen.";
   		document.getElementById("vr_err1").firstChild.nodeValue = "*";
  		err1=0;
  	}
  	else{
  		err1=1;
  	}

  	if (window.document.forms[0].absenderemail.value == "") {
   		document.getElementById("vr_err").firstChild.nodeValue = "Diese Angabe * bitte eintragen.";
   		document.getElementById("vr_err2").firstChild.nodeValue = "*";
  		err2=0;
  	}

	else if((window.document.forms[0].absenderemail.value.indexOf('@') == -1) || (window.document.forms[0].absenderemail.value.indexOf('.') == -1)){
		document.getElementById("vr_err").firstChild.nodeValue = "Diese Email-Angabe ist ungueltig.";
   		document.getElementById("vr_err2").firstChild.nodeValue = "*";
  		err2=0;
    }  	else{
  		err2=1;
  	}

  	if (window.document.forms[0].empfaengername.value == "") {
   		document.getElementById("vr_err").firstChild.nodeValue = "Diese Angabe * bitte eintragen.";
   		document.getElementById("vr_err3").firstChild.nodeValue = "*";
  		err3=0;
  	}
  	else{
  		err3=1;
  	}

  	if (window.document.forms[0].empfaengeremail.value == "") {
   		document.getElementById("vr_err").firstChild.nodeValue = "Diese Angabe * bitte eintragen.";
   		document.getElementById("vr_err4").firstChild.nodeValue = "*";
  		err4=0;
  	}
    else if ((window.document.forms[0].empfaengeremail.value.indexOf('@') == -1) || (window.document.forms[0].empfaengeremail.value.indexOf('.') == -1)){
		document.getElementById("vr_err").firstChild.nodeValue = "Diese Email-Angabe ist ungueltig.";
   		document.getElementById("vr_err4").firstChild.nodeValue = "*";
  		err4=0;
    } else{
  		err4=1;
  	}

	if(err1==1 && err2==1 && err3==1 && err4==1){
		document.EcardFormular.submit();
	}

  }//function

  function kill_tips(delFoc)
  {
	switch(delFoc)
	{
		case "1":
		    document.getElementById("vr_err1").firstChild.nodeValue = "";
			break;
		case "2":
		    document.getElementById("vr_err2").firstChild.nodeValue = "";
			break;
		case "3":
		    document.getElementById("vr_err3").firstChild.nodeValue = "";
			break;
		case "4":
			document.getElementById("vr_err4").firstChild.nodeValue = "";
			break;
	}
		    document.getElementById("vr_err").firstChild.nodeValue = "";
   }//function

function startFullscreen(x)
{
	document.write("<object id='vr_qtvrobject' classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab'><param name='src' value='" + x + ".mov' /><param name='autoplay' value='true' /><param  name='controller' value='true' /><param name='scale' value='tofit' /><param name='cache' value='true' /><param name='kioskmode' value='true' /><param name='fov' value='80' /><embed src='" + x + ".mov' autoplay='true' pan='180' controller='false' scale='tofit' cache='true' kioskmode='true' fov='80'pluginspace='http://www.apple.com/quicktime/download/standalone.html'></embed></object>");
	window.moveTo(0,0);
	window.resizeTo(window.screen.availWidth, window.screen.availHeight);
}

function startVR()
{
	document.getElementById('ptv').stopAutoPan();
	window.open('../deutsch/popup.html', 'rg', 'width=900,height=600,top=100,left=150');
}