// common.js

// newFunction
<!--
var showme="0";
topAdjustmentConst=0;
bottomAdjustmentConst=0;
bottomAdjustmentLeftConst=0;
siteWidth=800;
actSiteWidth=800;
function setConstants(topadj, bottomadj, bottomleftadj, sitewid)
{
	topAdjustmentConst=topadj;
	bottomAdjustmentConst=bottomadj;
	bottomAdjustmentLeftConst=bottomleftadj;
	siteWidth = sitewid;
	//alert("saved");
}
function isIE()
{
	var ret = "false";
	var browserName=navigator.appName;
	//alert(browserName);
	if (browserName=="Microsoft Internet Explorer")
	{
		ret="true";
	}
	return ret;
}
// Fade in Menu Script by Felipe Bottrel Souza 1998/99-Rio de Janeiro,Brazil
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
function menu(menuid, parentid)
{	
	//alert ("inside");
	disableMenu();
	//alert(topAdjustmentConst);
	if (document.getElementById(menuid)==null) return;
	//var wid= document.getElementById("Topmenu").offsetWidth - document.getElementById(parentid).offsetLeft;
	var wid= document.getElementById("maintable").offsetWidth - document.getElementById(parentid).offsetLeft;
	//alert (wid);
	wid = document.getElementById("Topmenu").offsetWidth;
	//alert (wid);
	var adjIE = 140; var adjMoz=130;
	var styleadj=0;
	
		//alert(document.body.style.topMargin);
		//document.getElementById(menuid).style.left= 40+document.getElementById(parentid).offsetLeft ;
		//alert (document.getElementById("maintable").style.height);
		document.getElementById(menuid).style.width = wid ;
		//alert(document.getElementById("Topmenu").style.height);
		//alert (document.getElementById(menuid).style.top);
		//alert(document.getElementById(menuid).style.left);
		//alert(document.getElementById("topmenurow").style.left);		
		document.getElementById(menuid).style.left = document.getElementById("topmenurow").style.left;
		//alert(document.getElementById(menuid).style.left);
		if(wid < 450)
		{
			document.getElementById(menuid).style.width  = wid +300
			document.getElementById(menuid).style.left = document.getElementById(parentid).offsetLeft - 300
		}
		if (isIE()=="true")
		{
			//OLD VALUE *** //document.getElementById(menuid).style.top= topAdjustmentConst+ 5+ document.getElementById(parentid).offsetHeight + document.getElementById("Topmenu").offsetHeight+document.getElementById("maintable").offsetTop;
	document.getElementById(menuid).style.top = document.getElementById(parentid).style.top;
	document.getElementById(menuid).style.top = topAdjustmentConst+document.getElementById(menuid).offsetTop+document.getElementById(parentid).offsetTop+document.getElementById(parentid).offsetHeight+(7)+"px";
			
			document.getElementById(menuid).filters.RevealTrans.apply();
			document.getElementById(menuid).style.visibility= "visible";			
			document.getElementById(menuid).filters.RevealTrans.play();		
		}
		else
		{
			//OLD VALUE **//document.getElementById(menuid).style.top= -2+topAdjustmentConst+document.getElementById(parentid).offsetHeight + document.getElementById("Topmenu").offsetHeight+document.getElementById("maintable").offsetTop;		
		document.getElementById(menuid).style.top = document.getElementById(parentid).style.top;
		document.getElementById(menuid).style.top = topAdjustmentConst+document.getElementById(menuid).offsetTop+document.getElementById(parentid).offsetTop+document.getElementById(parentid).offsetHeight+(7)+"px";			
			
			document.getElementById(menuid).style.visibility= "hidden";
			shiftOpacity(menuid, 1000, 0);	
			document.getElementById(menuid).style.visibility= "visible";
		}
		
}
function showOptions(id, menu)
{
			disableMenu();			
			//alert(document.getElementById("imagearea").offsetWidth);
			menu = "options"+menu;
			document.getElementById(menu).style.visibility= "hidden";
			document.getElementById(menu).style.left= document.getElementById(id).offsetLeft + 100
			//alert (document.getElementById("maintable").style.height);
			//document.getElementById("options1").style.top= 280 + document.getElementById(id).offsetTop		
			//alert (document.getElementById("options1").offsetTop);
			//document.getElementById("options1").style.top= document.getElementById(id).style.top	
			//*document.getElementById(menu).style.top = document.getElementById(id).style.top;
			//document.getElementById(menu).style.top = -36-25+document.getElementById(menu).offsetTop
			//*document.getElementById(menu).style.top = document.getElementById(menu).offsetTop-document.getElementById(menu).offsetHeight+"px";
			//alert(document.getElementById("tbloptions").offsetTop);
			//alert (document.getElementById(menu).offsetHeight);
			//alert (document.getElementById(menu).offsetTop);
			if (isIE()=="true")
			{
				//alert("isie");				
				moveOptionsMenu(menu, id);
				document.getElementById(menu).style.visibility="hidden";
				document.getElementById(menu).filters.RevealTrans.apply();
				document.getElementById(menu).style.visibility= "visible";
				document.getElementById(menu).filters.RevealTrans.play();
			}
			else
			{				
				document.getElementById(menu).style.visibility= "hidden";
				moveOptionsMenu(menu, id);
				shiftOpacity(menu, 1000, 0);			
				document.getElementById(menu).style.visibility= "visible";
			}

}

function moveOptionsMenu(mymenu, thisid)
{
	thisleft = bottomAdjustmentLeftConst+document.getElementById(thisid).offsetLeft + 100;	
	document.getElementById(mymenu).style.top = document.getElementById(thisid).style.top;
	document.getElementById(mymenu).style.top = bottomAdjustmentConst+document.getElementById(mymenu).offsetTop-document.getElementById(mymenu).offsetHeight+"px";
	
	actSiteWidth=document.getElementById("tbloptions").offsetWidth;
	//adjust the left for sitewidth and imagearea width
	if(document.getElementById("imagearea").offsetWidth > siteWidth) thisleft = thisleft+(siteWidth-document.getElementById("imagearea").offsetWidth)/2;
	//check the left
	//alert(thisleft);
	//alert(actSiteWidth);
	if(thisleft+document.getElementById(mymenu).offsetWidth- actSiteWidth > 0)
	{
		adjleft=actSiteWidth-document.getElementById(mymenu).offsetWidth+50;
		document.getElementById(mymenu).style.left = adjleft;
		//adjleft = -(thisleft+document.getElementById(mymenu).offsetWidth - actSiteWidth);
		//document.getElementById(mymenu).style.left = adjleft+thisleft;
	}
	else
	{
		document.getElementById(mymenu).style.left= thisleft;
	}
	//alert(document.getElementById(mymenu).style.left);

}
function disableMenu()
{
	//document.getElementById("list1").style.visibility="hidden";
	//document.getElementById("list2").style.visibility="hidden";
	//document.getElementById("options1").style.visibility="hidden";
	disableMenu2();
	disableMenu1();
	if(isIE()=="false")
	{
		//changeOpac(20, "imagearea");
	}
}



function shiftOpacity(id, millisec, inc)
{
	if(inc==0)
	{
		opacity(id, 0, 90, millisec);
	}
	else
	{
		opacity(id, 90, 0, millisec);
	}
}
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }    
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 101);
    object.MozOpacity = (opacity / 101);
    object.KhtmlOpacity = (opacity / 101);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function changeOpac2(opacity, id)
{
    object.opacity = (opacity / 101);
    object.MozOpacity = (opacity / 101);
    object.KhtmlOpacity = (opacity / 101);
}

function autofitIframe(id)
{
	var ht;
	
	if (!window.opera && !document.mimeType &&
         document.all && document.getElementById)
    {
         //alert("1");
         ht = this.document.body.offsetHeight;
         //document.getElementById(id).style.height = document.getElementById(id).document.documentElement.offsetHeight+"px";
         document.getElementById(id).style.width = document.getElementById("maintable").offsetWidth+"px";
 	}
	else if(document.getElementById) 
	{
         //alert("2");
         ht = this.document.body.scrollHeight;
         document.getElementById(id).style.width = document.getElementById("maintable").scrollWidth+"px";
	}
	
	document.getElementById(id).style.height= (ht + 50) + "px";
}

function insertIt1(fid) 
{
	document.getElementById(fid).height = document.getElementById(fid).contentWindow.document.body.scrollHeight;
/*
var _y = document.getElementById(id);
var _x = window.frames[0].document.Body.innerHTML;
_y.innerHTML = _x*/
alert("hey");
} 

function insertIt(the_iframe)
{

	the_iframe.style.height = the_iframe.contentWindow.document.body.scrollHeight;	//change the height of the iframe
	//the_iframe.style.width = the_iframe.contentWindow.document.body.scrollWidth;	//change the width of the iframe

}    

function setIFrameHeight(ht)
{
	alert("set height");
	document.getElementById("contentFRM").style.height=(ht + 50) + "px";
}



//-->