// JavaScript Document
// branch for native XMLHttpRequest object
var req = false;
if(window.XMLHttpRequest) {
	try {
		req = new XMLHttpRequest();
	} catch(e) {
		req = false;
	}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
	try {
		req = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e) {
		try {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
			req = false;
		}
	}
}

var calendarWindow = null;
var lastHighLightColor = '';

function highlight( obj, color )
{
	if (obj)
	{
		if (!color) color = '#FFFFFF';
		lastHighLightColor = obj.style.backgroundColor;
		obj.style.backgroundColor = color;
	}
}

function unhighlight( obj )
{
	if (obj)
	{
		obj.style.backgroundColor = lastHighLightColor;
	}	
}

function warning( form, str )
{
	if ( str )
	{
    	var c = confirm( str );
	}
	else
	{
		var c = true;
	}

    if ( c )
    {
        var i = 0;
        var myform = null;
        while( i != document.forms.length )
        {
            if ( document.forms[i].name == form )
            {
                document.forms[i].submit();
                break;
            }
            i++;
        }
    }
}


function openCalendar( url, params )
{
	
	calendarWindow = window.open( url + params, 'calendar', 'width=200, height=290' );
	calendarWindow.focus();
}


function openWindow( url, width, height, opt )
{
	window.open( url, 'a', 'width='+width+', height='+height+', scrollbars = yes'+opt);	
}


function message( str, css_class )
{
	var obj = document.getElementById("message");
	
	if (!obj)
	{
		alert('Page does not contains a message tag!');
		return false;
	}
	
	obj.style.display = 'block';
	obj.setAttribute('class', css_class);
	obj.innerHTML = str;
}


mycontent = new Array();

function showHide( obj_id )
{
	if (document.getElementById)
	{
		var myobj = document.getElementById( obj_id );
	}
	else if (document.all) 
	{
		var myobj = eval( 'document.all.' + obj_id );
	}

	len = mycontent.length;
	i = 0;
	while ( i != len )
	{
		if ( mycontent[i] && mycontent[i][0] == obj_id )
		{
			break;
		}
		
		i++;
	}

	if ( i == len )
	{
		i++;
		mycontent[i] = new Array(2);
	}

	if ( myobj.innerHTML != '<br>' && myobj.innerHTML != '<BR>' )
	{
		mycontent[i][0] = obj_id;
		mycontent[i][1] = myobj.innerHTML;
		myobj.innerHTML = '<br>';
		return true;
	}
	myobj.innerHTML = mycontent[i][1];
}

// Menu 
var disappeardelay=200  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function showhide(obj, e, visible, hidden){
	if (ie5||ns6)
	dropmenuobj.style.left=dropmenuobj.style.top=-500
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
		obj.visibility=visible
	else if (e.type=="click")
		obj.visibility=hidden
}

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")+10
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

/***********************************************
* Overlapping Content link- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var last_z_index = 1;
function overlay(curobj, subobj, offSetTop, offSetLeft){
	if (document.getElementById){
		var org_subobj = subobj;
		var subobj=document.getElementById(subobj);
		
		if ( subobj.style.visibility == 'visible' )
		{
			overlayclose(org_subobj);
			return false;
		}
		
		if ( !offSetTop ) offSetTop = 27;
		if ( !offSetLeft ) offSetLeft = 0;
		
		subobj.style.left=getposOffset(curobj, "left")+offSetLeft+"px"
		subobj.style.top=getposOffset(curobj, "top")+offSetTop+"px"
		subobj.style.zIndex = last_z_index + 1;
		subobj.style.visibility='visible';
		
		last_z_index += 1;
		return false
	}else
		return true
}

function overlayclose(subobj)
{
	document.getElementById(subobj).style.visibility='hidden'
}

function bring_in_front(obj)
{
	obj.style.zIndex = last_z_index + 1;
	last_z_index += 1;
}