//-- --------------------------------------------------------------------
//
//      AUTHOR :  Roman Zhovtulya
//
// JavaScript Library for Database Lab website
// --------------------------------------------------------------------
//
//      Versions :
//
//      date         version         By whoom and what was done
// --------------------------------------------------------------------
//      20.10.2002    V 1.0	     Roman, optimizing
//      
//                                  
//     
//
// --------------------------------------------------------------------

//function that closes the current window:

  function closewindow()
{


    window.close();

}




//function that refreshes the target window to the location (LocString) provided
// (used for automatic refresh when select box value is changed):


function popUpNav(LocString,wTarget) 
{
	if (LocString != "") {
		wTarget.location.href = LocString;
	}
}




//function that checkes user input:

function ValidForm(theForm)
{
  if (theForm.team_name.value == "")
  {
    alert("Please enter the team name!");
    theForm.team_name.focus();
    return (false);
  }

  if (theForm.student1.value == "")
  {
    alert("Please enter the name of the 1st memeber!");
    theForm.student1.focus();
    return (false);
  }

  if (theForm.student2.value == "")
  {
    alert("Please enter the name of the 2nd memeber!");
    theForm.student2.focus();
    return (false);
  }

}



//function opens a window based on the provided information:

function openwindow (url, w, h, name) 
{

window.open(url,name,'toolbar=no,resizable=yes, directories=no,status=no,scrollbars=yes,resize=no,menubar=no,width='+w+',height='+h);

}




// function for loading the URL content into the parent window (used in FHO Portal search engine):

function loadIntoParent(url) {
 opener.location.href=url;
}









// new function used to open a window in CMS editor in such a way that it would later be possible to close it and reload the parent page in Mozilla as well

function openwindowNew(url, w, h, name) 
{

child = window.open(url,name,'toolbar=no,resizable=yes,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,width='+w+',height='+h);

}



// function for closing the edit window and refreshing the parent
// (in administration "edit data" scrips):

//function closeChild() {

//child.close();
 
// self.location.reload();
//}


function closeChild() {

child.close();
 
 parent.location.reload();
}


// function for closing the child window from within the child window
// (for administration "edit data" scrips):

function endNow() {
 opener.location.href="JavaScript:closeChild()";
}






// function for loading the URL passed into the parent window
// and closing the child (used in linking to a file in HTMLArea):

function loadIntoParentWindow(url) {
 opener.location.href=url;
 opener.location.href="JavaScript:closeChild()";
}






// function for keeping the windows open:


function open_popup(page) {

     top.window_handle = open(page,'popupWindowName', "width=750,height=400");
    top.window_handle.focus();
    if (!top.window_handle.opener) top.window_handle.opener = self;
    return false;
}










// function for loading the URL content into the specified target frame
// (used in previewing while browsing files in upload window)

function loadIntoFrame(url) {
 parent.fhoportalSelectFilePreview.location.href=url;
}









//function used in voting:

        function poll24_submit() 
        { 

		if (document.poll_form24.choice[0].checked) {var c2=1;} 

		else if (document.poll_form24.choice[1].checked) {var c2=2;} 

		else if (document.poll_form24.choice[2].checked) {var c2=3;} 
		else if (document.poll_form24.choice[3].checked) {var c2=4;} 
		


		else {alert("Please make your choice"); var c2=0;} 

		if (c2!=0){ myWin = open("http://portal.mi.fh-offenburg.de/graduate-school/components/vote.jsp?choice="+c2, "displayWindow", "width=450,height=450,status=no,toolbar=no,menubar=no");} 

        }







// function that checks whether everything is correct for the upload:


function validFormUploadFile(theForm)
{


var filePath=theForm.FILE1.value;

// checking if the file name has been entered:

	//if (filePath.match(/ /))
	//{
	//   alert("Please select the file - Bitte wählen Sie die Datei!");
	//   alert(filePath);
	   
	//   return (false);
	//}


// checking if the file name contains forbidden characters (space, +, etc):
	
	// looking for a file name substring:
		// getting the index of the last occurance of "\":
		
		var lastSlashIndex=0;

		// looping through the file path and checking for "\" position:
		// (we've got to use "\\", since a single "\" is interprited as an escape character only:
		
		for(i=0; i<filePath.length; i++)
			{
		  	
		  	if ( filePath.charAt(i)=='\\')
		  		{
		  		
		  		lastSlashIndex=i;
		  		
		  		}
		  	
			}
		
		
	// getting the file name:
	

	var fileName=filePath.substring(lastSlashIndex+1, filePath.length);


	if (fileName.match(/ /))
	{

	   alert("Sorry spaces are not allowed in file names - Sorry, Lehrzeichen in Dateinamen sind nicht erlaubt!");
	   
	   return (false);
	}

	if (fileName.match(/\+/))
	{

	   alert("Sorry plus signs are not allowed in file names - Sorry, plus Zeichen in Dateinamen sind nicht erlaubt!");
	   
	   return (false);
	}



}










// functions for left menu

  function MM_findObj(n, d) { //v4.0
      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 && document.getElementById) x=document.getElementById(n); return x;
    }
    
    function MM_showHideLayers() { //v3.0
      var i,p,v,obj,args=MM_showHideLayers.arguments;
      for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
        if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
        obj.visibility=v; }
    }
    
    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    }



    var isDOM      = (typeof(document.getElementsByTagName) != 'undefined'
                      && typeof(document.createElement) != 'undefined')
                   ? 1 : 0;
    var isIE4      = (typeof(document.all) != 'undefined'
                      && parseInt(navigator.appVersion) >= 4)
                   ? 1 : 0;
    var isNS4      = (typeof(document.layers) != 'undefined')
                   ? 1 : 0;
    var capable    = (isDOM || isIE4 || isNS4)
                   ? 1 : 0;
    // Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant
    if (capable) {
        if (typeof(window.opera) != 'undefined') {
            capable = 0;
        }
        else if (typeof(navigator.userAgent) != 'undefined') {
            var browserName = ' ' + navigator.userAgent.toLowerCase();
            if (browserName.indexOf('konqueror') > 0) {
                capable = 0;
            }
        } // end if... else if...
    } // end if
    var fontFamily = 'arial, geneva, sans-serif';
    var fontSize   = 'small';
    var fontBig    = 'large';
    var fontSmall  = '12';
    var fontLarge  = '12';    
    
    var isServer   = true;
    
