var offset1 = 342;
function setLayers(){
	
	if(getBrowserType()=='IE')return;
	scrH = window.outerHeight;
	//scrH = screen.height;
	scrW = screen.width;
	obj = document.getElementById('windowContent');
	//obj.style.height = 'auto';
	var hg = obj.offsetHeight;
	contentH = scrH - offset1;
	//alert(obj = document.getElementById('ttt').offsetHeight);
	//alert(typeof(screen.height));
	
	//obj.offsetHeight= 100;
	//alert(x);
	//obj.style.height =  "1002%";	
	//obj.offsetHeight= 200;
	//obj.style.display = "inline"; 
	//obj.style.Height = '50%'; 
	//alert(contentH+'px');
	//alert(contentH+'px');
	obj.style.height=contentH+'px';
	//obj.style.border='1px solid black';
	//document.getElementById("ttt").style.backgroundColor="#333333"
	//alert(obj.Height);
	//document.getElementById(spanId).getAttribute('id')
}


realHtmlArea = false;

/* --- html area (form edit) new window scripts --- */
function htmlAreaEdit(fillTextArea,path) {
	var w = 800;
	var h = 600;
	x = ( screen.width - w) / 2;
	y = ( screen.height - h) / 2;
	
	realHtmlArea = document.all[fillTextArea];
	
//	myEditor = window.open('lib/js/fckeditor/htmlarea.php',"htmlarea","resizable=yes,toolbar=no,scrollbars=yes,menubar=no,status=yes,directories=no,width="+w+",height="+h+",left="+x+",top="+y+"");
	myEditor = window.open('lib/js/fckeditor/htmlarea.php',"htmlarea","resizable=1,toolbar=0,scrollbars=1,menubar=0,status=1,directories=0,maximize=1");
}
function print_r(theObj){
 	
  if(theObj.constructor == Array ||
     theObj.constructor == Object){
    
    document.write("<ul>")
    for(var p in theObj){
      if(theObj[p].constructor == Array||
         theObj[p].constructor == Object){
document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");
        document.write("<ul>")
        print_r(theObj[p]);
        document.write("</ul>")
      } else {
document.write("<li>["+p+"] => "+theObj[p]+"</li>");
      }
    }
    document.write("</ul>")
  }
}


var clipTop = 0;
var clipWidth = 170;
var clipBottom = 50;
var topper = 300;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

function init()
{
	DHTML = (document.getElementById || document.all || document.layers)
	if (!DHTML) return;
	var x = new getObj('windowContent');
	
	print_r(x);
	if (document.layers)
	{
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		alert('initing');
		lyrheight = x.obj.offsetHeight;
		x.style.clip = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function stopScroll()
{
	if (time) clearTimeout(time);
}


function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function getBrowserType(){
	 if (navigator.userAgent.indexOf("Opera")!=-1&& document.getElementById) type="OP";

		//Internet Explorer e.g. IE4 upwards :
		if (document.all) type="IE";
		
		//For Netscape version 4 :
		if (document.layers) type="NN";
		
		//Mozila e.g. Netscape 6 upwards
		if (!document.all && document.getElementById) type="MO"; 
		
		return type;
}

function safeGoto_direct2(loc,mytext) {
	if (confirm(mytext)) {
		//goto_other =  true;
		window.location =  loc; 
	}
}
