
defaultStatus = "Volksstimme.de Tickets";

var em_pop, em_pop2;
function em_popup(popurl,popopt){
	if(typeof(popurl) == "undefined") popopt = "width=400,height=450,scrollbars=1,";
	if(!popopt.match(/resizable=/)) popopt+= ",resizable=0";
	if(!popopt.match(/menubar=/)) popopt+= ",menubar=0";
	if(!popopt.match(/toolbar=/)) popopt+= ",toolbar=0";
	if(!popopt.match(/location=/)) popopt+= ",location=0";
	if(popopt.match(/scrollbar=/)) popopt = popopt.replace("scrollbar=","scrollbars=");
	if(!popopt.match(/scrollbars=/)) popopt+= ",scrollbars=0";

	var tmp_option = new Array();
	tmp_option = popopt.split(",");
	for(var i=0; i<tmp_option.length; i++){
	    tmp_o=tmp_option[i].replace(/=/,'="') + '"';
		if(tmp_o) eval(tmp_o);
	}
	if(document.layers){
		popopt = popopt.replace("width","innerWidth");
		popopt = popopt.replace("height","innerHeight");
	}
	popurl+= (popurl.indexOf("?") ? "&" : "?")
					+"em_client=bti"
					+"&em_site_color=2"
					+"&em_site_style=2"
					+"&em_site_template=2"
					+"&em_site_text=2";
	popopt+= ",left="+Math.round((screen.availWidth-Number(width))/2);
	popopt+= ",top="+Math.round((screen.availHeight-Number(height))/2);
	if(window.name == "content"){
		if(!popurl.match("/print"))
			self.location.href = popurl+"&back=1";
		else{
			delete em_pop2;
			em_pop2 = open(popurl,'em_pop2',popopt);
			em_pop2.focus();
		}
	}else{
		if(top.name != "em_pop"
		&& typeof(em_pop) != "undefined"
		&& em_pop.closed == false
		&& navigator.platform.match(/Mac/) == null
		){
			em_pop.close();
			delete em_pop;
		}
		if(typeof(popurl) != "undefined"){
			delete em_pop;
			em_pop = open(popurl,'em_pop',popopt);
			em_pop.focus();
		}
	}
}

function em_check_suche(form){
	if(form.such){
		var test_such = form.such.value;
				test_such = test_such.replace(/(^| )(\+|-|AND|OR|NOT)( |$)/i,"");
				test_such = test_such.replace(/ /i,"");
		if(!test_such || form.such.value == "Suche"){
			alert("Geben Sie bitte einen Suchgbegriff ein!");
			form.such.focus(); return false;
		}
		if(test_such.length < 3){
			alert("Geben Sie bitte mindestens 3 Zeichen ein!");
			form.such.focus(); return false;
		}
	}
}

function em_field_focus(field,aktiv){
	if(!document.layers && field){
		field.style.border	= aktiv ? "1px solid #808080" : "1px solid #D3D3CC";
		field.style.color		= aktiv ? "#203050" : "#808080";
	}
}

function em_myonline_check(form){
	if(form.my_user){
		if(!form.my_user.value){
			alert("Geben Sie bitte Ihren Benutzernamen ein!");
			form.my_user.focus(); return false;
		}
		if(!form.my_pass.value){
			alert("Geben Sie bitte Ihr Passwort ein!");
			form.my_pass.focus(); return false;
		}
		if(form.my_pass.value.length < 3){
			alert("Geben Sie bitte mindestens 6 Zeichen ein!");
			form.my_pass.focus(); return false;
		}
	}
}

function em_nspopup(){
	if(document.layers && top.name != "main" && top.name != "pop"){
		top.name = "main";
		em_popup();
	}
	if(top.name != "main" && top.name != "pop"){
		top.name = "main";
	}
}

if(document.layers){
	nsWidth = window.innerWidth;
	nsHeight= window.innerHeight;
}

function em_nsresize(){
	if(document.layers){
		if(window.innerWidth != nsWidth || window.innerHeight != nsHeight)
			window.location.reload()
	}
}

function em_fill_gallery(wie,structure){

    var active = document.getElementById("intEmGalleryFirst"+structure).value;

    if(wie=="vor"){
         --active;
        if(active < 0){
            active = (em_ArrGallery[structure].length-1);
        }
    }
    if(wie=="zurueck"){
        ++active;
        if(active > (em_ArrGallery[structure].length-1)){
            active = 0;
        }
    }

    document.getElementById("intEmGalleryFirst"+structure).value = active;

    for(var i=0; i<=3; ++i){
        if(em_ArrGallery[structure][active]){
            if(em_ArrGallery[structure][active][0] && em_ArrGallery[structure][active][2]){
                document.getElementById("emImgGallery"+structure+"_"+i).innerHTML = '<a href="'+em_ArrGallery[structure][active][2]+'" ><img src="'+em_ArrGallery[structure][active][3]+'" style="height:80px;" border="0"/></a>';
            }else{
                document.getElementById("emImgGallery"+structure+"_"+i).innerHTML = '<a href="'+em_ArrGallery[structure][active][2]+'" ><img  src="/no.gif" style="height:80px;" border="0"/></a>';
            }

            if(em_ArrGallery[structure][active][1] ){
                document.getElementById("emTextGallery"+structure+"_"+i).innerHTML = em_ArrGallery[structure][active][1];
            }else{
                document.getElementById("emTextGallery"+structure+"_"+i).innerHTML = "";
            }
        }
        ++active;
        if(active > (em_ArrGallery[structure].length-1)){
            active = 0;
        }
    }

}