﻿var ua = navigator.userAgent.toLowerCase();
	isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1));

function hideElms(elmTag) {
	for (i=0; i<document.all.tags(elmTag).length; i++){
		obj = document.all.tags(elmTag)[i];
		if (!obj || !obj.offsetParent) continue;
		obj.style.visibility = "hidden";
	}
}
function showsubmenu($sid){
    var temp=document.getElementById($sid);
    if (temp.style.display == 'none'){
		document.cookie = "lastmenu=" + escape($sid);
        temp.style.display='block';
    }
    else{
		document.cookie = "lastmenu=" + escape('') ;
        temp.style.display='none';
    }
}
function showimg(many,url1,url2,url3,pname){
	//return TB_show(pname,url1)
	if (many==1){
		var newarray=new Array();
		if (url1.length>5){
			newarray[0]=url1;
		}
		if (url2.length>5){
			newarray[1]=url2;
		}
		if (url3.length>5){
			newarray[2]=url3;
		}
		return TB_show2(pname,url1,newarray);
	}
	else{
		return TB_show(pname,url1)
	}
}
function op(url,urlid){
window.open(url,urlid,"width=400,height=360,scrollbars=no")
}

function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	//arrayPageScroll = new Array('',yScroll)
	//return arrayPageScroll;
	return yScroll
}

function hpicture(url,body_title,body_data){
	$("#HP_load").css({display:"block"});
	imgPreloader = new Image();
	imgPreloader.onload = function(){
		imgPreloader.onload = null;
		var x = 330;
		var y = 330;
		var imageWidth = imgPreloader.width;
		var imageHeight = imgPreloader.height;
		if (imageWidth > x) {
			imageHeight = imageHeight * (x / imageWidth); 
			imageWidth = x; 
			if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
			}
		} else if (imageHeight > y) { 
			imageWidth = imageWidth * (y / imageHeight); 
			imageHeight = y; 
			if (imageWidth > x) { 
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x;
			}
		}
				// End Resizing		
		$("#HP_picture").html('<img src="'+url+'" alt=""/>');
		window.setTimeout("document.getElementById('HP_load').style.display='none'",1000);
	}
	imgPreloader.src = url;
	var content_body='<table cellspacing="1" cellpadding="10" class="plist">';
	for (i=0;i< body_title.length;i++ )
	{
		content_body+='<tr><th>'+body_title[i]+'</th><td>'+body_data[i]+'</td></tr>';
	}	
	content_body+='</table>'
	$("#content_body").html(content_body);
	return false;
}

