// JavaScript Document


//---------------------init functions------------------------------------------------
//so, the naming format of the content page is "[pagename]_innerpage.html"
function getInnerPageName()
{
	return getPageName() + "_innerpage.html";
}	
//function to return the current page name without ".html", the flash nav will call this to highlight the node this page is on
function getPageName()
{
	var url =location.href;
	var pagename = url.substring(url.lastIndexOf("/")+1, url.lastIndexOf("."));
	return pagename ;
}



function initPage()
{
	var obj = document.getElementById("navbar");
	//document.getElementById("flashVars").value="curpage=theClient";
	//obj.Play();
	
	//obj.highlightNode('theClient');
	
	
	loadContentPage( getInnerPageName() );
	
	
	//check if no flah, show non flash nav
	if( returnQueryStringVarVal("flash") == "no" )
	{
		document.getElmentById('flashNav').style.display = 'none';	
		document.getElmentById('nonflashNav').style.display = 'inline';	
	}
}


//----------AJAX stuff to load the content page
var xmlContentDOM;
function loadContentPage( htmlfile)
{	

	 if (typeof window.ActiveXObject != 'undefined' ) {
        xmlContentDOM = new ActiveXObject("Microsoft.XMLHTTP");
        xmlContentDOM.onreadystatechange = callback_xmlContent ;

      }
      else {
        xmlContentDOM = new XMLHttpRequest();
        xmlContentDOM.onload = callback_xmlContent ;
		

	  }
    	
		xmlContentDOM.open( "GET",  htmlfile, true );	//true is async mode
      	xmlContentDOM.send( null );
	
		
}

function callback_xmlContent()
{
	if (xmlContentDOM.readyState == 4)
	{ 
		document.getElementById("contentArea").innerHTML = xmlContentDOM.responseText;

		//displayJobDropdown("jobRoleMiddle");
		
		//reclaim memory
		xmlContentDOM = null;		
    	//alert("show wiz1");
		

		
  } 
}

//----------------------------------------- end init--------


//------------- click to jump to a particular section
function gotoSection( contentdivid, anchorid )
{
	//alert(document.getElementById(anchorid).top);
	
	var offset = getYPosToScroll(contentdivid, anchorid);
	window.scrollBy(0,  offset);

}

function gotoTop()
{
	window.scrollBy(0,  0);
	alert('hey');
}

//function to find the Y position of the anchor to scroll to - relative to the parentmost obj
function getYPosToScroll(parentmostid, anchorid)
{
	//if( parentmostid != null )
//		var parentmost = document.getElementById(parentmostid);
	//else
	//	var parentmost = '';
	
	var anchor = document.getElementById(anchorid);
    var y = 0;
    while (anchor ) {

      y += anchor.offsetTop;
      anchor = anchor.offsetParent;
	  
    }
	
    return y-50;
  

}



var qsParm = new Array();
function returnQueryStringVarVal( qvar )
{
	var query = window.location.search.substring(1);
	var parms = query.split('&');
		for (var i=0; i<parms.length; i++) 
		{
			var pos = parms[i].indexOf('=');
			if (pos > 0) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			qsParm[key] = val;
			
			if( qvar == key )
				return val;
			}
		}
		
		
}

//if we want to jump straight to a section, use the function below in the body onload
function checkToJumpToASection()
{
	if( qParm['section'] != null )
		gotoSection('template_innerpage.html',qParm['section']);
}

//function to open a popup for sending mail

function popUpContact( subject)
{
	url="http://www.eleaneonline.com/orca/orca_contact/popupContactOrca.php?subject=" +subject  ; //"http://localhost/orca_prototype/orca_contact/popupContactOrca.php?subject="+subject;
	//window.name = "main";
	window.open( url, "popupWindow", 'width=420, height=350, menubar="no", scrollbars=1' );

}



//-->
<!--
/* Script by: www.jtricks.com
 * Version: 20060303
 * Latest version:
 * www.jtricks.com/javascript/navigation/floating.html
 */


function move_menu()
{
    if (document.layers)
    {
        floating_menu.left = fm_next_x;
        floating_menu.top = fm_next_y;
    }
    else
    {
        floating_menu.style.left = fm_next_x + 'px';
        floating_menu.style.top = fm_next_y + 'px';
    }
}

function compute_shifts()
{
    fm_shift_x = has_inner
        ? pageXOffset
        : has_element
          ? document.documentElement.scrollLeft
          : document.body.scrollLeft;
    if (target_x < 0)
        fm_shift_x += has_inner
            ? window.innerWidth
            : has_element
              ? document.documentElement.clientWidth
              : document.body.clientWidth;

    fm_shift_y = has_inner
        ? pageYOffset
        : has_element
          ? document.documentElement.scrollTop
          : document.body.scrollTop;
    if (target_y < 0)
        fm_shift_y += has_inner
            ? window.innerHeight
            : has_element
              ? document.documentElement.clientHeight
              : document.body.clientHeight;
}
var timer;
function float_menu()
{
    var step_x, step_y;

    compute_shifts();

    step_x = (fm_shift_x + target_x - fm_next_x) * .07;
    if (Math.abs(step_x) < .5)
        step_x = fm_shift_x + target_x - fm_next_x;

    step_y = (fm_shift_y + target_y - fm_next_y) * .07;
    if (Math.abs(step_y) < .5)
        step_y = fm_shift_y + target_y - fm_next_y;

    if (Math.abs(step_x) > 0 ||
        Math.abs(step_y) > 0)
    {
        fm_next_x += step_x;
        fm_next_y += step_y;
        move_menu();
    }

    timer = window.setTimeout('float_menu()', 20);
};


	var target_x = 5
var target_y = 60;

var has_inner = typeof(window.innerWidth) == 'number';
var has_element = document.documentElement && document.documentElement.clientWidth;



var fm_shift_x, fm_shift_y, fm_next_x, fm_next_y;

function initPijimal()
{	compute_shifts();
	if (document.layers)
	{
		// Netscape 4 cannot perform init move
		// when the page loads.
		fm_next_x = 0;
		fm_next_y = 0;
	}
	else
	{
		fm_next_x = fm_shift_x + target_x;
		fm_next_y = fm_shift_y + target_y;
		move_menu();
	}
	floating_menu.style.display = 'block';
	float_menu();
}


var isShow = 0;
function showMePijimal()
{
	if( isShow == 0)
	{
		
		//floating_menu.style.top = target_y;
		//floating_menu.style.left = target_x;
		
		
		initPijimal();
		
		isShow =1;
	}
	else
	{
		floating_menu.style.display = 'none';
		
		
		window.clearTimeout(timer);
		isShow = 0;
	}
}

/// ------- open vdo popup
//function to open a popup for sending mail

function popUpVDO( url )
{
	  //"http://localhost/orca_prototype/orca_contact/popupContactOrca.php?subject="+subject;
	//window.name = "main";
	window.open("vdoPopup.html?url=" +url, "popupWindow", 'width=430, height=345, menubar="no", scrollbars=0' );

}