var startpage = "http://www.vng-norge.no";
var AnzeigeStartpage = 0;  // ist es die Startpage ?
var EditierModus     = 1;  // eingeloggt im Editor ?

////// Browsertyp
var browser  = "";
app_name = window.navigator.userAgent;
app_name = app_name.toLowerCase();;  
brs_name = window.navigator.appName; 
brs_name = brs_name.toLowerCase();
if ((brs_name.indexOf("explorer") >= 0) || (app_name.indexOf("explorer") >= 0)){ browser  = "ie" ;}
if ((brs_name.indexOf("opera") >= 0) || (app_name.indexOf("opera") >= 0)){ browser  = "opera" ;}
if ((brs_name.indexOf("x11") >= 0) || (app_name.indexOf("x11") >= 0)){ browser  = "x11" ;}

onError = no_Error;
function no_Error(){ 
	return true;
}


////// Fenstergroesse    
function windowSize(m){
	var window_s;  
	if(browser == "ie"){
		if(m == "w"){
			window_s = document.body.clientWidth;
		}
		else{
			window_s = document.body.clientHeight;
		}
	} 
	else{
		if(m == "w"){
			window_s = window.innerWidth;
		}
		else{
			window_s = window.innerHeight;
		}
	}
	return window_s;
}
    
var objectLayer;	//
var objectStyle;
var objectPos;

function getMethod(){
 if (document.all){
  objectLayer = 'document.all[\'';
  objectStyle = '\'].style';
  objectPos   = '\']'; 
 } 
 else{
   if(document.layers){
      objectLayer = 'document.layers[\''; 
      objectStyle = '\']'; } 
   else{ 
      if (document.getElementById){
        objectLayer = 'document.getElementById(\''; 
        objectStyle = '\').style';
        objectPos   = '\')';  
      } 
      else {}  
   } 
 }
}

function modLayer(nameLayer,actionLayer,toDo){ 
if (objectLayer) {
 layerString = objectLayer + nameLayer + objectStyle + actionLayer + toDo;
 //alert(layerString);
 layer = eval(layerString);
} 
}

function makeHistory(){
 history.back();
}

function printIt(){
  if(window.print){
     window.print();}
}

function setStyle(id){
  
  if (browser == "ie" && document.all && (app_name.indexOf("opera") == -1) == true ){       
			var elem = document.getElementById("s_" + id);
			if( elem.className == "color_normal" || elem.className == "color_hover" ){
				//alert(id.className);
				var stat; 
				if( elem.className == "color_hover" ){ stat = "color_normal"; }
				if( elem.className == "color_normal" ){ stat = "color_hover"; }
				codeStart = "document.all.";
				codeEnd = "";      
				toset = codeStart + "s_" + id +codeEnd + ".className = \"" + stat + "\";";
				eval(toset);
				//alert(todo);
			}
  }
  
}

function moveDiv(c){
    if(c == 0){
    	stat = "balken_n";
    	moving = 0;
    }
    if(c == 1){
    	stat = "balken_d";
    	moving = 1;
    }
    setStyle('balken',stat);
    
}

function callFltr(im){
    //alert(im);
    
    if (browser == "ie" && document.all ){
    	   //alert('Internet Explorer < IE 7');

         im = document.images[im];
         var imgID = (im.id) ? "id=\"" + im.id + "\" " : ""
         var imgClass = (im.className) ? "class=\"" + im.className + "\" " : ""
         var imgTitle = "";
         var imgStyle = "display: inline-block " + im.style.cssText;
         var strNewHTML = "<span " + imgID + imgClass ///  + imgTitle
         strNewHTML += " style=\"margin: 0px; padding: 0px; " + imgStyle + "; " + "width:" + im.width + "px; height:" + im.height + "px; "
         strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         strNewHTML += "(src=\'" + im.src + "\', sizingMethod='noscale');\"></span>" 
         im.outerHTML = strNewHTML
         //alert(im.src)
	 }
	 
	 
}

// Img swap (Mouseover)
function swapImg(id,nr){
  if(! document.layers){
   if(document.images){t = "document.images['" + id + "'].src= icons[" + nr + "]"}
   eval(t);
   //alert(t);
  }
}

function openWin(file,ww,hh,fname,sb){

if(file == 'login'){file = '../editor/login'; ww = 200; hh = 200; fname = 'editor'; sb = 'yes';}
toeval ="mwindow = window.open(\""+file+"\",\""+fname+"\",\"width="+ww+",height="+hh+",toolbar=no,dependent=yes,scrollbars="+sb+",resizable=yes,status=yes\")";
eval(toeval);
}

function checkMail(f){
var myvalue = document.forms[f].mail.value;
if((myvalue.indexOf("@") < 0) || (myvalue.indexOf(".") < 0) || (myvalue.indexOf(",") >= 0) || (myvalue.indexOf(":") >= 0) || (myvalue.indexOf(";") >= 0)  || (myvalue * 1 == 0)){
return 0;}
else{return 1;}
}

getMethod();
