var preloadFlag = false;
function preloadImages() {
if (document.images) {
    topNav2Bg_over = newImage("images/topNav2Bg.jpg");
    
    preloadFlag = true;
}
}


get_element = document.all ?
function (s_id) { return document.all[s_id] } :
function (s_id) { return document.getElementById(s_id) };

function getWidth(name) {    
	/*var tmpElem = get_element(name);	*/
	var tmpElem= document.getElementById(name);
	return tmpElem.offsetWidth;

}

function setWidth(name1,name2) {
	var tmpElem1 = get_element(name1);
	var width1 = getWidth(name1);
	var tmpElem2 = get_element(name2);
	var width2 = getWidth(name2);
	
	tmpElem2.style.width = 920-width1+"px";
}

function getHeight(name) {    
	var tmpElem = get_element(name);
	if(tmpElem.currentStyle) return tmpElem.offsetHeight;       
	else return parseInt(document.defaultView.getComputedStyle(tmpElem, "").getPropertyValue("height")); 
	
}

function setHeight(name) {
	var tmpElem = get_element(name);
	var height = getHeight(name);
	
	//alert('wrapper ='+height);
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	if(height>=myHeight)
		tmpElem.style.height = height+"px";
	else tmpElem.style.height = myHeight+"px";
	//alert('wrapper ='+height);
}

function setHeight2(name1, name2, name3){
	var tmpElem = get_element(name1);
	var height1 = getHeight(name1);
	var height2 = getHeight(name2);
	var height3 = getHeight(name3);
	
	//alert('leftNav = '+height1);
	//alert('middlePart = '+height2);
	//alert('rightPart = '+height3);
	
	// middle content is the longest
	if ( (height1<height2) && (height3<height2))
		tmpElem.style.height = height2-24+"px";
	// right content is the longest
	else if ( (height1<height3) && (height2<height3))
		tmpElem.style.height = height3-24+"px";
	// LeftNav should be the longest
	else if( (height1>=height2) && (height2>=height3))
		tmpElem.style.height = height1+"px";
	else if( (height1>=height2) && (height2<height3))
		tmpElem.style.height = height1+"px"; 
	else if ( (height1>=height3) && (height2<height3))
		tmpElem.style.height = height1-24+"px";
	
		//alert("tmpElem="+tmpElem.style.height);
}

function setHeight3(name1, name2){
	var tmpElem = get_element(name1);
	var height1 = getHeight(name1);
	var height2 = getHeight(name2);
	
	//alert ('left : ' + height1);
	//alert ('right: ' + height2);
	
	if(height1<height2 && (height2 - height1 > 24))
		tmpElem.style.height = height2-24+"px";
	else tmpElem.style.height = height1+"px";
	
}

function openNewWinNoOptions(url,w,h){
	myWidth = 800;
	myHeight = 600;
    
	if(url != null){//if url is supplied continue
		if(w != null){myWidth=w;}	//define w if it is not already defined
		if(h != null){myHeight=h;}	//define h if it is not already defined
		window.open(url,'_blank','width='+ this.myWidth +',height='+this.myHeight+',resizable=no,scrollbars=no'+
				',toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no');
	}else{//tell the user that no parameters have been passed.
		window.alert("No URL specified. - Cannot continue");
	}
}

function addBtmShadow(name1,name2){
	var tmpElem1 = get_element(name1);
	var tmpElem2 = get_element(name2);
	var height = getHeight(name1);
	
	//alert('wrapper ='+height);
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	if(height<myHeight){
		var oldHTML = tmpElem2.innerHTML;
		var newHTML = "<img src='../images/bottomShadow.jpg'>";
		tmpElem2.innerHTML = newHTML;
	}

}

function hideSeperator1(sep1,sep2, image2){
    //alert("image2 " + image2);
    var tmpSep1 = get_element(sep1);
    var tmpSep2 = get_element(sep2);
 
     tmpSep1.style.background = "url(" + image2 +") repeat-x top left;";
     tmpSep2.style.background = "url(" + image2 +") repeat-x top left;";
}

function showSeperator1(sep1,sep2){
    var tmpSep1 = get_element(sep1);
    var tmpSep2 = get_element(sep2);
    
   tmpSep1.style.background="none";
   tmpSep2.style.background="none";
}

var dd;

function hideSeperator2(sep1, image1){
    //alert("image1 " + image1);
    var tmpSep1 = document.getElementById(sep1);  
    tmpSep1.style.background = "url(" + image1 +") repeat-x top left;";
}

function showSeperator2(sep1){
    var tmpSep1 = get_element(sep1); 
     tmpSep1.style.background="none";        
}
