/**
 * TAXNEWS JavaScript core
 *
 * @author  Peter Dobetsberger <p.dobetsberger@edelweiss72.de>
 *
 * Conventions:
 * Variables in camelCase
 * Classes in PascalCase
 * Function/Methods in camelCase
 */
 
TRADEFAIR = {};

// Helper für show/hide
TRADEFAIR.findObj = function (n, d) { 
    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=TRADEFAIR.findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// Helper für show/hide 
TRADEFAIR.changeProp = function (objName,x,theProp,theValue) { 
    var obj = TRADEFAIR.findObj(objName);
    if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
    eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
    }
}

// hide Layer 
TRADEFAIR.hideLayer = function (setDiv) {
	  TRADEFAIR.changeProp(setDiv,'','style.display','none','DIV');
}

// show Layer
TRADEFAIR.showLayer = function (setDiv) {
	  TRADEFAIR.changeProp(setDiv,'','style.display','block','DIV');
}


// show Layer
TRADEFAIR.goTo = function (URL) {
    popwin=window.open(URL);
}

TRADEFAIR.resetForm = function (text) { 
    if (confirm(text)===true) {
        document.f.reset();
    }
}


// oeffnet Popup wird für popup-Modul benötigt
TRADEFAIR.openPopup = function (URL,popname,W,H,scroll,rezisable,X,Y) {
  	var URL,popname,W,H,scroll,rezisable,X,Y;
  	if (!popname) { popname='popup'; }
  	if (!W) { W=520; }
  	if (!H) { H=460; }
  	if (!scroll) { scroll=0; }
  	if (!rezisable) { rezisable=0; }
  	if (!X) { X=screen.width/2-(W/2); }
  	if (!Y) { Y=screen.height/2-(H/2)-20; }
  	properties = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable="+rezisable+",";
  	properties += "width="+W+",height="+H+",left="+X+",top="+Y;
  	popwin=window.open(URL,popname,properties);
  	popwin.focus();
}


// wird für popup-Modul in easyred benötigt 
function openPopup(URL,popname,W,H,scroll,rezisable,X,Y) {
  	var URL,popname,W,H,scroll,rezisable,X,Y;
  	if (!popname) { popname='popup'; }
  	if (!W) { W=520; }
  	if (!H) { H=460; }
  	if (!scroll) { scroll=0; }
  	if (!rezisable) { rezisable=0; }
  	if (!X) { X=screen.width/2-(W/2); }
  	if (!Y) { Y=screen.height/2-(H/2)-20; }
  	properties = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scroll+",resizable="+rezisable+",";
  	properties += "width="+W+",height="+H+",left="+X+",top="+Y;
  	popwin=window.open(URL,popname,properties);
  	popwin.focus();
}

