// JavaScript Document
function openHeader()
{
	fdiv = document.getElementById("flashdiv");
	if (navigator.appName.indexOf("Microsoft") != -1) 
		fdiv.style.pixelHeight = 500;
	else
		fdiv.style.height = '500px';
	//document.getElementById('contentdiv').innerHTML += "<br>open";
}
function closeHeader()
{
	fdiv = document.getElementById("flashdiv");
	if (navigator.appName.indexOf("Microsoft") != -1) 
		fdiv.style.pixelHeight = 120;
	else
		fdiv.style.height = '120px';
	//document.getElementById('contentdiv').innerHTML += "<br>close";
}

function callFlash()
{
	thisMovie("fejlec").closeALL();
}

function callFlashfooter()
{
	thisMovie("lablecmenu").closeALL();
}


function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}



function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  tomb = [myWidth, myHeight]
  /*window.alert( 'Width = ' + tomb[0] );
  window.alert( 'Height = ' + myHeight );*/
  return tomb;
}

function move(from){
	cdiv = document.getElementById('contentdiv');
	fdiv = document.getElementById('footerdiv');
	hdiv = document.getElementById('flashdiv');
	//ldiv = document.getElementById('leftMenu');
	//if (navigator.appName=="Netscape")
	 //document.body.clientWidth;
	//if(pageWidth <= 990)
		//pageWidth = 990;
	//cdiv.style.pixelLeft = 	Math.ceil((pageWidth-988)/2);
	if(document.getElementById('footerdiv'))
	{
		
		
		 if (navigator.appName.indexOf("Microsoft") != -1) {
		pageWidth = alertSize()[0];
		wh = alertSize()[1];
		
		if (pageWidth > 990)
			fdiv.style.pixelLeft = 	Math.ceil((pageWidth-696)/2);
		else
			fdiv.style.pixelLeft = Math.ceil((990-696)/2);
		
		if(wh-30 >= document.body.clientHeight)
			fdiv.style.pixelTop = wh-60;
			else
			fdiv.style.pixelTop = document.body.clientHeight-25;
			
		 }else
		 {
				 pageWidth = alertSize()[0];
				wh = alertSize()[1];
			
			if (pageWidth > 990)
			{
				fdiv.style.left = 	Math.ceil((pageWidth-696)/2)+'px';
				hdiv.style.left = 	Math.ceil((pageWidth-990)/2)+'px';
			}
			else
			{
				fdiv.style.left = Math.ceil((990-696)/2)+'px';
				hdiv.style.left = '0px';
				/*cdiv.style.left = '0px';*/
			}
			
			if(wh >= document.body.clientHeight)
				fdiv.style.top = (wh-65)+'px';
				else
			fdiv.style.top = document.body.clientHeight+'px';
		 }
	}
		//alert(fdiv.style.pixelTop);
	
	//cdiv.style.pixelHeight = fdiv.style.pixelTop-180;
	//ldiv.style.pixelHeight = fdiv.style.pixelTop-180-18;
	
	
	
	//alert(document.body.clientHeight+":"+wh);
		//else
		//jobbsarok = ((document.body.clientWidth/2) + JobbOldala);
	/*if(from == 1)
	{
		clearInterval(IntervalID);
		hdiv.style.visibility = "visible";
		cdiv.style.visibility = "visible";
		fdiv.style.visibility = "visible";
		//alert("interval törölve");
	}
	else
		IntervalID = setInterval('move(1)',1000);
		*/
	
	
}
function FormSubmit(oldal){
	//alert(oldal);
	document.form1.action = oldal;
	document.form1.submit();	
}


function reg(type){
	//alert(oldal);
	document.getElementById('dw').value = 'reg'+type;
	//alert(document.getElementById('dw').value);
	if(type == 0)
		FormSubmit('zold-kalkulator.php');
	else
		FormSubmit('kapcsolat.php');
}
function next(step){
	//alert(oldal);
	if(step == 0)
	{
	//document.getElementById('dw').value = 'reg'+type;
	//alert(document.getElementById('dw').value);
	window.location.href= 'zold-kalkulator.php';
//	FormSubmit('zold-kalkulator.php');
	}
	if(step == 1)
	{
	//document.getElementById('dw').value = 'reg'+type;
	//alert(document.getElementById('dw').value);
	FormSubmit('zold-kalkulator.php');
	}
	if(step == 2)
	{
		saveData('zold-kalkulator.php', 'calculate');
	}
}

function saveData(oldal, dw){
	//alert(oldal);
	document.getElementById('dw').value = dw;
	//alert(document.getElementById('dw').value);
	FormSubmit(oldal);
}

function deleteData(oldal, sid){
	//alert(oldal);
	document.getElementById('dw').value = "delete";
	document.getElementById('toBeDeleted').value = sid;
	//alert(document.getElementById('dw').value);
	FormSubmit(oldal);
}


function setPid(oldal, pid){
	//alert(oldal);
	document.getElementById('id').value = pid;
	FormSubmit(oldal);
}

function OpenUploadWindow(id)
 {
   uw = window.open ("uploadphoto.php?id="+id,"uw","location=0,status=0,scrollbars=0,width=528,height=252");
  //uw.moveTo(0,0);
 } 
 function OpenUploadWindowDoc(id)
 {
   uw = window.open ("uploaddoc.php?id="+id,"uwd","location=0,status=0,scrollbars=0,width=528,height=252");
  //uw.moveTo(0,0);
 }
 function OpenHelpWindow(id)
 {
   uw = window.open ("termhelp.php?id="+id,"th","location=0,status=0,scrollbars=0,width=528,height=252");
  //uw.moveTo(0,0);
 } 

window.onresize = Function("move()");
window.onload = Function("move()");
 
