
defaultStatus = "Mindener Tageblatt";

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(/scrollbars?=/)) popopt+= ",scrollbars=0";
	if(popopt.match(/scrollbar=/)) popopt = popopt.replace(/scrollbar=/,"scrollbars=");

	var tmp_option = new Array();
	tmp_option = popopt.split(",");
	for(var i=0; i<tmp_option.length; i++){
		if(tmp_option[i] && !tmp_option[i].match(/location/)) eval(tmp_option[i]);
	}
	popopt = popopt.replace(/=1(,|$)/g,"=yes$1");
	popopt = popopt.replace(/=0(,|$)/g,"=no$1");
	if(document.layers){
		popopt = popopt.replace("width","innerWidth");
		popopt = popopt.replace("height","innerHeight");
	}
	if(popurl.indexOf("/(^|\/)_/") >= 0){
		popurl+= (popurl.indexOf("?") >= 0 ? "&" : "?")
						+"em_client=mt"
						+"&em_subclient=mt"
						+"&em_ssc=MSw3MzgsMSwxMzk0LDEsNjEyLDEsMA==";
	}
	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 #BFBFBF";
		field.style.color		= aktiv ? "#202020" : "#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;
		}
	}
	return true;
}

if(top.name != "main" && top.name != "pop"){
	top.name = "main";
}

function ftvlaunch_old(video,quality,pid) {
	var LeftPosition = (screen.width) ? (screen.width-665)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-430)/2 : 0;
	var popwin = open('http://www.zoomin.tv/videoplayer/index.cfm?id='+video+'&mode=normal&quality='+quality+'&pid='+pid,'MTV6_window','toolbar=no,width=665,height=430,top='+TopPosition+',left='+LeftPosition+',directories=no,status=no,statusbar=0,scrollbars=no,resizable=no,menubar=no');
	if(popwin) popwin.focus();
}

function ftvlaunch(video,quality,pid) {
    var LeftPosition = (screen.width) ? (screen.width-670)/2 : 0;
    var TopPosition = (screen.height) ? (screen.height-500)/2 : 0;
    var popwin = window.open('http://bongo.zoomin.tv/videoplayer/index.cfm?id='+video+'&mode=normal&quality='+quality+'&pid='+pid,'MTV6_window','toolbar=no,width=670,height=500,top='+TopPosition+',left='+LeftPosition+',directories=no,status=no,statusbar=0,scrollbars=no,resizable=no,menubar=no');
    if(popwin) popwin.focus();
}

var	em_menue_over=null;
var	em_menue_timer=null;
var	em_menue_active_id=null;
var	em_menue_active_loc=null;
function em_menue(loc,id,over){
	if(	document.getElementById
	&&	document.getElementById("em_"+loc+"_menue_pos"+id)
	&&	document.getElementById("em_"+loc+"_menue_loc"+id)
	){
		var menue_pos=document.getElementById("em_"+loc+"_menue_pos"+id);
		var menue_loc=document.getElementById("em_"+loc+"_menue_loc"+id);
		if(	em_menue_active_id){
			if(	em_menue_active_id != id){
				em_menue_hide();
			}else
			if(em_menue_timer){
				clearTimeout(em_menue_timer);
			}
		}
		em_menue_over=over?true:false;
		em_menue_active_id=id;
		em_menue_active_loc=loc;
		// Position der Eltern zusammenrechnen
		var	pItem=menue_pos;
		var	par_top=parseInt(menue_pos.offsetHeight)-1;
		var	par_width=parseInt(menue_pos.offsetWidth) + 100;
		var	par_left=0;
		while(pItem){
			par_top+=parseInt(pItem.offsetTop) + 3;
			par_left+=parseInt(pItem.offsetLeft) - 50;
			pItem=pItem.offsetParent;
		}

				// Toleranz des Pipes
		menue_loc.style.top=par_top+"px";
		menue_loc.style.left=par_left+"px";
		menue_loc.style.display="block";
		if(	loc=="local"
		&&	menue_loc.style.width < par_width
		){
			menue_loc.style.width=par_width+"px";
		}
		em_menue_timer=setTimeout("em_menue_hide()",200);
	}
}

function em_menue_hide(loc){
	if(	document.getElementById
	&&	em_menue_active_id
	&&	em_menue_active_loc
	&&	!em_menue_over
	&&	document.getElementById("em_"+em_menue_active_loc+"_menue_loc"+em_menue_active_id)
	){
		document.getElementById("em_"+em_menue_active_loc+"_menue_loc"+em_menue_active_id).style.display="none";
		clearTimeout(em_menue_timer);
		em_menue_active_loc=null;
		em_menue_active_id=null;
	}

}

/*--------------------

 * COOKIE FUNCTIONS

 *------------------*/



function emSetCookie(_strCookieName, _strCookieValue) {

    var arrOptions = { path: '/', expires: 999 };

    jQuery.cookie(_strCookieName, null, arrOptions);

                jQuery.cookie(_strCookieName, _strCookieValue, arrOptions);

}



function emGetCookie(_strCookieName) {

    jQuery.cookie(_strCookieName);

}



function emDeleteCookie(_strCookieName) {

    jQuery.cookie(_strCookieName, null);

}


