
//------------------------------------------------
//Basic open, close and toggle
//------------------------------------------------

function menuopen(menu) {
	document.getElementById(menu).style.display = "block";

}

function menuclose(menu) { 
	document.getElementById(menu).style.display = "none";

}

function toggle(menu) {

	if (document.getElementById(menu).style.display == "block") {
		document.getElementById(menu).style.display = "none";
	}
	else {
		document.getElementById(menu).style.display = "block";
	}

}



//------------------------------------------------
//This function launches IFRAME DIV popup and places it in a fixed coordinate
//------------------------------------------------
function openIFrameLayer(strURL,strWidth,strHeight)
{
    var y
    y = document.getElementById('AlertIFrame');

    if (arguments[1] == null)
    {
		y.style.width='550px';
		y.style.height='300px';    
	}
	else
	{
		eval('y.style.width=\'' + strWidth + 'px\'');
		eval('y.style.height=\'' + strHeight + 'px\'');
    }
	menuopen('divDynamicAlert');
	y.src = strURL;

}


//------------------------------------------------
//This function launches IFRAME DIV popup and captures the coordinate of the last mouse click
//------------------------------------------------
function openIFrameLayerClick(strURL,strWidth,strHeight,e,xaxis,yaxis) {

    var y
    y = document.getElementById('AlertIFrame');

    if (arguments[1] == null)
    {
		y.style.width='550px';
		y.style.height='300px';    
	}
	else
	{
		eval('y.style.width=\'' + strWidth + 'px\'');
		eval('y.style.height=\'' + strHeight + 'px\'');
    }


    var x_axis=y_axis=0;

    if (window.event) {
        x_axis = window.event.x;
        y_axis = (window.event.y) + (document.body.scrollTop);
    }
    else {
    	if (document.getElementById) {
     	x_axis = e.pageX;
     	y_axis = e.pageY;
    	}
   	else if (document.layers) {
     	x_axis = e.pageX;
      	y_axis = e.pageY;
    }
    }








    document.getElementById('divDynamicAlert').style.left = x_axis + xaxis;
    document.getElementById('divDynamicAlert').style.top = y_axis + yaxis;

    menuopen('divDynamicAlert');
    y.src = strURL;

}




//------------------------------------------------
//This function launches IFRAME DIV popup, captures the coordinate of the last mouse click but try to center the popup
//------------------------------------------------
function openIFrameLayerCenter(strURL,strWidth,strHeight) {


    var y
    y = document.getElementById('AlertIFrame');

    if (arguments[1] == null)
    {
		y.style.width='550px';
		y.style.height='300px';    
	}
	else
	{
		eval('y.style.width=\'' + strWidth + 'px\'');
		eval('y.style.height=\'' + strHeight + 'px\'');
    }

	//setTimeout("CenterDiv("+strWidth+","+strHeight+")",100);



	//FOR FIREFOX note that +50 and -50 is offset for console layout	

	if (window.innerHeight) { 
    		x_center = (window.innerWidth/2) - (strWidth/2)-50;
    		y_center = (window.innerHeight/2) - (strHeight/2) + document.body.scrollTop-50;
			if (y_center < 0) {
				y_center = 0
			}
	}
	else { 

	//FOR IE
    		x_center = (document.body.clientWidth/2) - (strWidth/2)-50;
    		y_center = (document.body.offsetHeight/2) - (strHeight/2) + document.body.scrollTop-50;
			if (y_center < 0) {
				y_center = 0
			}
	}


    	document.getElementById('divDynamicAlert').style.left = x_center;
    	document.getElementById('divDynamicAlert').style.top = y_center;


    	menuopen('divDynamicAlert');
    	y.src = strURL;


}













//------------------------------------------------
//This is to close iframe div
//------------------------------------------------
function hideDynamicAlert() 
{
	menuclose('divDynamicAlert');
}



//------------------------------------------------
//Dummy function
//------------------------------------------------
function click(){
}



