// JavaScript Document

/* für inputfelder in den suchen */
function clearer(pobj)
{ 
	pobj.value=""; 
}

function clearstandard(standard, pobj)
{ if (pobj.value == standard)
	{	pobj.value=""; }
}

function setstandard(standard, pobj)
{ if (pobj.value == "")
	{	pobj.value=standard; }
}

function RadioSelectedValue(RadioGroup)
{
	for (i = 0; i < RadioGroup.length; i++)
		if (RadioGroup[i].checked)
			return RadioGroup[i].value;
}

/* popups öffnen */
function nicksitepop(SI_ID, HELP, US_ID)
	{
 		strOpenWin = 'http://www.eventszene.at/scripts/nicksite.dll/home?si_id=' + SI_ID + '&us_id=' + US_ID; 		
        var win1=window.open(strOpenWin,"Nicksite","width=539,height=646,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win1.focus();	
	}


function nicksitepopupspecial(SPEZIAL, SI_ID, HELP, US_ID)
	{
 		strOpenWin = 'http://www.eventszene.at/scripts/nicksite.dll/' + SPEZIAL + '?si_id=' + SI_ID + '&us_id=' + US_ID; 		
        var win1=window.open(strOpenWin,"Nicksite","width=539,height=646,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win1.focus();	
	}
	
function nicksitepopupsearchuser(SI_ID)
	{

 		if (document.SEARCHUSER1.US_NICKNAME.value == 'Usersuche')
		   document.SEARCHUSER1.US_NICKNAME.value = ' '; 
		
		strOpenWin = 'http://www.eventszene.at/scripts/nicksite.dll/searchuser?si_id=' + SI_ID + '&splash=1'; 		
        var win1=window.open(strOpenWin,"Nicksite","width=539,height=646,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win1.focus();	
	}


function printview_event(SI_ID, CH_ID, EN_ID)
	{
 		strOpenWin = '../../scripts/events.dll/printevent?si_id=' + SI_ID + '&ch_id=' + CH_ID + '&en_id=' + EN_ID; 		
        var win1=window.open(strOpenWin,"Druckansicht","width=587,height=646,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win1.focus();	
	}


function printview_location(SI_ID, EN_ID)
	{
 		strOpenWin = '../../scripts/locations.dll/printlocation?si_id=' + SI_ID + '&en_id=' + EN_ID; 		
        var win1=window.open(strOpenWin,"Druckansicht","width=587,height=646,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win1.focus();	
	}


function popup_autologin()
	{
 		strOpenWin = '../../../ez/templates/misc/complete_autologin.htm'; 		
        var wina=window.open(strOpenWin,"Autologin","width=490,height=205,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        wina.focus();
	}

function popup_agb_b2c()
	{
 		strOpenWin = '../../../ez/templates/misc/complete_verbraucheragb.htm'; 		
        var wina=window.open(strOpenWin,"AGB","width=550,height=550,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        wina.focus();
	}


function popup_va(seite)
	{
 		strOpenWin = '../../../ez/templates/misc/complete_' + seite + '.htm'; 		
        var wina=window.open(strOpenWin,"Autologin","width=750,height=350,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        wina.focus();
	}

function popup_tp(was,weite,hoehe)
	{
 		strOpenWin = '../../../ez/templates/thirdparty/popup_' + was + '.htm'; 		
        var wina=window.open(strOpenWin,"Eventcontent","width="+weite +",height="+ hoehe +",menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        wina.focus();
	}
	
function popup_ticketshopinfo(seite,fenstername,hoehe)
	{
		strOpenWin = '../../../ez/images/ticketshop/ticketshopinfoseite/popup_' + seite + '.htm'; 		
        var wina=window.open(strOpenWin,fenstername,"width=607,height="+ hoehe +",menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        wina.focus();
	}

function popup_pp()
	{
		strOpenWin = 'http://www.eventszene.at/ez/templates/static/twyn/pp.htm?tmp=1'; 		
        var wina=window.open(strOpenWin,"Vorteilszone","width=630,height=600,menubar=no,resizable=yes,scrollbars=no,toolbar=no");
        wina.focus();
	}

function popup_ch()
	{
 		strOpenWin = '../../../ez/templates/misc/complete_channelhilfe.htm'; 		
        var wina=window.open(strOpenWin,"Autologin","width=500,height=250,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        wina.focus();
	}
	
function voucher(SI_ID, VO_ID, FORMACTIONID)
	{
 		strOpenWin = '../shop.dll/printvoucher?si_id=' + SI_ID + '&vo_id=' + VO_ID + '&formactionid=' + FORMACTIONID; 		
        var win1=window.open(strOpenWin,"Gutschein","width=545,height=600,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win1.focus();	
	}

function neuigkeiten(NUMMER)
	{
 		strOpenWin = 'http://www.eventszene.at/ez/images/neuigkeiten/' + NUMMER + '.htm'; 		
        var win1=window.open(strOpenWin,"Neuigkeiten","width=545,height=305,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win1.focus();	
	}

function popup_ticketshop(strUrl)
	{
        var wina=window.open(strUrl,"Ticketshop","width=680,height=646,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        wina.focus();
	}


/*
function kalender
function popup_bsp_(bold..)
*/

/* das is die funktion für die js links im popup die wieder im hauptfenster angezeigt werden sollen */
/* das is die funktion für die js links im popup die wieder im hauptfenster angezeigt werden sollen */
function mainwindow(LINK)
{
	try
	{
		if ( !opener || opener == null || opener == self.window || opener.closed == true || opener.name == 'shoutbox' )
		{ 
			var win1=window.open(LINK,"eventszene"); 
		}
		else 
		{
			window.opener.location.href=LINK; 
			window.opener.focus(); 
		}
	}
	catch(e)
	{
		/* Shoutbox / Frame -> neues Fenster */
		var win1=window.open(LINK,"eventszene"); 
	}
}

function goback(COUNT)
	{
		history.go(-COUNT);
	}


/* ---- TICKETSHOP ---- */

function cyplan(tsurl, pid,plan) {

 		strOpenWin = tsurl + 'cyplan?pid=' + pid + '&plan=' + plan;
        var win1=window.open(strOpenWin,"cyplan","width=575,height=580,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win1.focus();
}


function tarife() {

 		 strOpenWin = 'http://www.eventszene.at/ez/images/ticketshop/versandtarife.htm'; 		
        var win2=window.open(strOpenWin,"vers","width=490,height=265,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win2.focus();
}

function sesp() {

 		 strOpenWin = 'http://www.eventszene.at/ez/images/ticketshop/servicespesen.htm'; 		
        var win3=window.open(strOpenWin,"vers","width=460,height=145,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win3.focus();
}


function oetcenter() {
 		strOpenWin = 'http://www.eventszene.at/ez/images/ticketshop/oetcenter.htm'; 		
        var win4=window.open(strOpenWin,"vers","width=490,height=465,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win4.focus();
}

function agb() {

 		 strOpenWin = 'http://www.eventszene.at/ez/images/ticketshop/agb.htm'
        var win5=window.open(strOpenWin,"agb","width=490,height=500,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win5.focus();
}


function zahlvor() {

 		 strOpenWin = 'http://www.eventszene.at/ez/images/ticketshop/zahlvor.htm';
        var win6=window.open(strOpenWin,"","width=490,height=215,menubar=no,resizable=yes,scrollbars=yes,toolbar=no");
        win6.focus();
}

function kartart_setzen() {      
		var i=0;

		while (i<100 && eingForm.ZAHLART[i].value!=2)
		{
			i++;
		}
    	if (eingForm.ZAHLART[i].value==2) 
		{
		   eingForm.ZAHLART[i].checked=true;
		}
}



/* Channelpin-Cookie */

function SetChannelPinCookie(cookiedomain, region, time)
{
	var regionvalue = region[region.selectedIndex].value;
	var timevalue = time[time.selectedIndex].value;

	document.cookie = 'channelpin_cookie=' + escape('region=' + regionvalue + '$time=' + timevalue) + '; domain=' + cookiedomain + '; path=/;';

}


function DeleteChannelPinCookie(cookiedomain)
{

	document.cookie = 'channelpin_cookie=; domain=' + cookiedomain + '; expires=0; path=/;';

}



/* SMILEYS */

function smiley(what, form_name, textarea_name)
 {
  if (document.forms[form_name].elements[textarea_name].createTextRange)
   {
    document.forms[form_name].elements[textarea_name].focus();
    document.selection.createRange().duplicate().text = what + ' ';
   }
  else if (document.getElementById && !document.all) // Mozilla
   {
    var tarea = document.forms[form_name].elements[textarea_name];
    var selEnd = tarea.selectionEnd;
    var txtLen = tarea.value.length;
    var txtbefore = tarea.value.substring(0,selEnd);
    var txtafter =  tarea.value.substring(selEnd, txtLen);
    tarea.value = txtbefore + what + ' ' + txtafter;
   }
  else
   {
    document.entryform.text.value += what + ' ';
   }
}



/* zum anzeigen uns verstecken der smileyübersicht*/

function hidesmiley()
{ 
	document.getElementById('smiley').style.height = 1;
	document.getElementById('smiley').style.visibility = "hidden";
	document.getElementById('smileylink').style.visibility = "visible";
	document.getElementById('smileylink').style.height = 15;
	document.getElementById('smileylink').style.marginTop = 1;
}

function showsmiley()
{ 
	document.getElementById('smiley').style.width = 100 + '%' ;
	document.getElementById('smiley').style.height = 115;
	document.getElementById('smiley').style.visibility = "visible";
	document.getElementById('smileylink').style.visibility = "hidden";
	document.getElementById('smileylink').style.height = 1;
	document.getElementById('smileylink').style.marginTop = 0;	
}



/* für die email adds */
function kontakt(adresse)
{
	document.write('<a href="' + 'mailto:' + adresse + '@eventszene.at' + '">');
}

function kontaktinfo(adresse, betreff, text )
{
	document.write('<a href="' + 'mailto:' + adresse + '@eventszene.at' + '?subject=' + betreff + '&body=' + text + '">');
}



/* beschränkt den input auf max erlaubte zeichen  */
function RestlicheZeichenErmitteln(form, anz)
{
var ErlaubteAnzahl=anz;
Laenge=document.getElementById('Nachricht').value.length;

if(Laenge>ErlaubteAnzahl)
	{
		document.Formular.Nachricht.value=document.Formular.Nachricht.value.substring(0,ErlaubteAnzahl);
	}
}

/* fürs event eintragen */
function CheckManydates(formobj)
{
	if (document.adddate.as_manydates.checked)
		formobj.as_manydates.value="1"; 
	else
		formobj.as_manydates.value="0";

	formobj.as_manydatescomment.value=document.adddate.as_manydatescomment.value;
}

/* event eintragen zusatzprodukte direkt in den seiten */

/* Zahlen formatieren (1.234,00), laenge = anzahl nachkommastellen */
function FormatNumber(number, laenge)
{
  var sep = ",";
  var th_sep = ".";

  number = Math.round( number * Math.pow(10, laenge) ) / Math.pow(10, laenge);
  str_number = number+"";
  arr_int = str_number.split(".");
  if(!arr_int[0]) arr_int[0] = "0";
  if(!arr_int[1]) arr_int[1] = "";
  if(arr_int[1].length < laenge){
    nachkomma = arr_int[1];
    for(i=arr_int[1].length+1; i <= laenge; i++){  nachkomma += "0";  }
    arr_int[1] = nachkomma;
  }
  if(th_sep != "" && arr_int[0].length > 3){
    Begriff = arr_int[0];
    arr_int[0] = "";
    for(j = 3; j < Begriff.length ; j+=3){
      Extrakt = Begriff.slice(Begriff.length - j, Begriff.length - j + 3);
      arr_int[0] = th_sep + Extrakt +  arr_int[0] + "";
    }
    str_first = Begriff.substr(0, (Begriff.length % 3 == 0)?3:(Begriff.length % 3));
    arr_int[0] = str_first + arr_int[0];
  }
  if (laenge == 0)
	return arr_int[0];
  else
	return arr_int[0]+sep+arr_int[1];
}

/* beschränkt textareas auf eine bestimmte anzahl von zeichen */
function maxzeichen(pobj, anz)
{
var ErlaubteAnzahl=anz;
Laenge=pobj.value.length;

if(Laenge>ErlaubteAnzahl)
	{
		pobj.value=pobj.value.substring(0,ErlaubteAnzahl);
	}
}


function whereisbar (wo)
{
	document.getElementById('whereis').innerHTML = "<a href=http://www.eventszene.at/scripts/channel.dll/home?si_id=2&help=0>Home</a> > " + wo;
}
