/*
* Window popup: no resize
if (window.showModalDialog) {
		thisWindow = window.showModalDialog(newsitem,title,"width="+x+",height="+y+",scrollbars=yes,screenX=0,screenY=0,toolbar=no,location=no,menubar=no");		
	} 
	else {
		thisWindow = window.open(newsitem,title,"width="+x+",height="+y+",scrollbars=yes,screenX=0,screenY=0,toolbar=no,location=no,menubar=no");
	}
*/
function window_popup( newsitem, x, y, title ) {
	var thisWindow;
	thisWindow = window.open(newsitem,title,"width="+x+",height="+y+",scrollbars=auto,screenX=0,screenY=0,toolbar=no,location=no,menubar=no");
	thisWindow.moveTo((screen.width-x)/2,(screen.height-y)/3);
 	thisWindow.window.focus();
}
/*
* Window popup: resize
*/
function window_popup2( newsitem, x, y, title ) {
	var thisWindow;
	thisWindow = window.open(newsitem,title,"width="+x+",height="+y+",scrollbars=yes,screenX=0,screenY=0,toolbar=no,location=no,menubar=no");
	thisWindow.moveTo((screen.width-x)/2,(screen.height-y)/3);
 	thisWindow.window.focus();
}

function window_popupPage( newsitem, title ) {
	var thisWindow;
	var x = 920;
	var y = 700;
	thisWindow = window.open(newsitem,title,"width="+x+"px,height="+y+"px,scrollbars=yes,screenX=0,screenY=0,toolbar=no,location=no,menubar=no, status=no, resizable=yes, copyhistory=no");
	thisWindow.moveTo((screen.width-x)/2,(screen.height-y)/3);
 	thisWindow.window.focus();
}
/*
* show hide layer
*/

function showHideFormSection(layerName, actionType, frameName)
{
	var background;
	//if no action specified, this function will toggle the current state	
	if (document.getElementById(layerName) == null)
		return false;
	if (actionType == 2)
	{
		 if(document.getElementById(layerName).style.display != "none"){
			new_style = "none";
			background = "hideLayer";
		}
		 else{
			new_style = "block";
			background = "showLayer";
   		}//end else
   }
   else
   	new_style = (actionType == 1) ? "block" : "none";
	if(document.getElementById("showHideLayer") != null){
		document.getElementById("showHideLayer").className = background;
	}//end if
   	document.getElementById(layerName).style.display = new_style;
}

function showHideSection(layerName, actionType, frameName)
{
	var background;
	//if no action specified, this function will toggle the current state	
	if (document.getElementById(layerName) == null)
		return false;
	if (actionType == 2)
	{
		 if(document.getElementById(layerName).style.display != "none"){
			new_style = "none";
			background = "hideLayer";
		}
		 else{
			new_style = "block";
			background = "showLayer";
   		}//end else
   }
   else
   	new_style = (actionType == 1) ? "block" : "none";
    document.getElementById(layerName).style.display = new_style;
}

/*
* this function is used into the gallery image system: display the small image using the big bimages
*/
function showBigImage( id, srcLink, imgID){
	document.getElementById(id).src = srcLink;
	document.getElementById(id).title = document.getElementById(imgID).innerHTML;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}