function MM_swapImgRestore() { //v3.0
 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
   //alert("ja");
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*
 * 
 */

function MM_openBrWindow(theURL,winName,features) { //v2.0
  	window.open(theURL,winName,features);
}


/*
 * 
 */

function openPopup(site, articleID, articleHeadline) {
	//alert(site);
	//alert(articleID);
	
	var popUpwindow = window.open("medienAdministration/"+site+"?articleID="+articleID+"&articleHeadline="+articleHeadline, "popup", "width=900,height=400,scrollbars=yes");
}

/*
 * 
 */
 
function alertMessage(message) {
	alert(message);
}

function popupOpen(url,name, b, h, scrolling_yes_no) {
      //alert("huhu popup");
      // zentriert 
      links = (screen.width/2)-(b/2);
      oben =(screen.height/2)-(h/2);
      
      win=window.open(url,name,"height="+h+",width="+b+",status = no,toolbar = no,menubar = no,location = no,resizable = no,titlebar = no,scrollbars ="+scrolling_yes_no+",fullscreen = no,top ="+oben+",left ="+links);
      win.focus()
}

function checkLoginFields() {
	 
	var user = document.login.user.value;
	var password = document.login.password.value;
	var checked = true;
	
	//alert(user);
	//alert(password);
	
	if (user == "") {
		alert("Bitte geben Sie Ihren Usernamen ein!");
		checked = false;
		document.login.user.focus();
		return;
	}
	if (password == "") {
		alert("Bitte geben Sie Ihr Passwort ein!");
		checked = false;
		document.login.password.focus();
		return;
	}
	if (user == "" && password == "") {
		alert("Bitte geben Sie Ihren Benutzernamen und Ihr Passwort ein!");
		checked = false;
		document.login.user.focus();
		return;
	}
	
	if (user != "" && password != "") {
		checked = true;
	}
	
	if (checked) {
		document.login.method = "post";
		document.login.action = "index.php?login=1";
		document.login.submit();
	}
}

/*
 * 
 */
 
function go2Page(link) {
    //alert("go2Page= "+link);
    location.href = link;
}

/*
 * 
 */
 
function clearInput() {
    document.getElementById('searchString').value = "";
}

/*
 * 
 */
 
function search() {
	//alert("search");
    var searchString = document.getElementById('searchString').value;
    //alert(searchString);
    
    if (searchString == undefined || searchString == "") {
        alert("Sie haben keinen Suchbegriff eingegeben!");
        return;
    }
    
    //location.href="search.php?q="+searchString;
    location.href="search"+"-"+searchString+".php";
}

/*
 * 
 */

function addTFTEventListener( swfName, eventName, methodName ) {
        $(swfName).addTFTEventListener( eventName, methodName );
}
 
/* events videoplayer */
function doRegisterVideoplayerEvents( id ) {
        addTFTEventListener( id, 'medOpenLandingPage', 'open_video_browser' );
}
 
/* opens the video landingpage */
function open_video_browser(video_time_frame,vid,landingPageUrl) {
       // alert("test");
		if (typeof landingPageUrl != 'undefined') window.location.href = landingPageUrl;    
}

/*
 * 
 */
 
/*function changeFlashContent(click) {
    alert("changeFlashContent= "+click);

    doPassVar(click);
}*/

/*
 * 
 */

/*function doPassVar(value){
	//alert(value);
	var sendText = value;

	window.document.myFlash.SetVariable("click", sendText);
	window.document.myFlash.GotoFrame(1);
	window.document.myFlash.Play();
}*/


/*
 * 
 */
 
/*function init() {
    //alert("init");
    setScrollContainerPosition('1','6');
}*/

/*
 * 
 */
 
/*function setScrollContainerPosition(top, left) {
    var scrollContainer = document.getElementById('scrollContainer');
    
    scrollContainer.style.top = top;
    scrollContainer.style.left = left;
}*/

/*
 * 
 */
 
/*function scrollUp() {
	//alert("scrollUp");
    
    var scrollContainer = document.getElementById('scrollContainer');
    scrollContainer.style.top = -50;
}

function scrollDown() {
	var scrollContainer = document.getElementById('scrollContainer');
    scrollContainer.style.top = +50;
}*/

/*
 * 
 */

/*function popUP_Upload() {
	//alert("huhu");
	
	var popUpwindow = window.open("pictureUpload/inputFormular.php", "popup", "width=600,height=400");
}*/

/*
 * 
 */

/*function windowClose(fileArray) {
	
	var popUpwindow = window.open("pictureUpload/proccessUpload.php", "popup", "width=600,height=400");
	popUpwindow.close();
	
	//setPictures(fileArray);
}*/

/*
 * 
 */

/*function setPictures(fileArray) {
	//alert(fileArray.length);
	
	//var string = "";
	
	for (count=0; count<fileArray.length; count++) {
		//alert(fileArray[count]);
		
		//if (fileArray[count] != "") {
			string += fileArray[count]+"   ";
			alert(string);
		//}
		
		
	}
	
	//alert(opener.parent.bottom.document.getElementById('picturesIDs').textContent);
	
	if(opener.parent.bottom.document.all){
	     //string = fileArray[0];
		 opener.parent.bottom.document.getElementById('picturesIDs').innerText = string;
	} else{
	      //string = fileArray[0];
		 opener.parent.bottom.document.getElementById('picturesIDs').textContent = string;
	}
	
}*/

