isIE6 = (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) && (navigator.userAgent.toLowerCase().indexOf('msie 7') == -1);

function printContent(qry) {
	var win = window.open("print_page.asp?" + qry, "print" ,
		"status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=1, scrollbars=1, height=600, width=800");
	win.focus();
}

function emailContent(qry) {
	var win = window.open("email_page.asp?" + qry, "print" ,
		"status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=1, scrollbars=1, height=400, width=800");
	win.focus();
}

function isEmail(str)
{
	var emailRegxp = /^([\w]+)(.[\w]+)*@([\w]+)([.-][\w-]+)*(.[\w]{2,3}){1,2}$/;
	if (emailRegxp.test(str) != true)
		return false;
	return true;
}

function changeImage(img_name,img_src) {
document[img_name].src=img_src;
}

function ChangeStyle(eid)
{
	document.cat3.all.style.fontSize = "14pt";
  //document.getElementById(eid).style.fontSize = "14pt";
  document.getElementById(eid).style.fontWeight = "bold";
  //document.getElementById("MyTag").style.color = "red";
}

var fade_dir = "";
var fade_callback = null;
function call_fade_callback() {
	if (fade_callback) {
		fade_callback();
		fade_callback = null;
	}
	fade_dir = "";
}
function fade(id, inout, millisec, callback) {
    //speed for each frame
	var speed = Math.round(millisec / 100);
    var timer = 0;
	if (callback) {fade_callback = callback;}
	//if (fade_dir == "") {
		fade_dir = inout;
		//determine the direction for the blending, if start and end are the same nothing happens
		if (inout == "in") {
			for(i = 0; i <= 100; i++) {
				setTimeout("changeOpac(" + i + ",'" + id + "'" + ((i==100)?", true":"")+")",(timer * speed));
				timer++;
			}
		} else {
			for(i = 100; i >= 0; i--) {
				setTimeout("changeOpac(" + i + ",'" + id + "'" + ((i==0)?", true":"")+")",(timer * speed));
				timer++;
			}
		}
	//} else {
		//setTimeout("fade('"+id+"', '"+inout+"', "+millisec+")", 100);
	//}
}

function opacity() {
    //speed for each frame
    var millisec=7000;
	var speed = Math.round(millisec / 100);
    var timer = 0;
	var id='fadeImg';
    //determine the direction for the blending, if start and end are the same nothing happens
        for(i = 100; i >= 0; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
}

//change the opacity for different browsers
function changeOpac(opacity, id, callback) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
	if (callback) {
		call_fade_callback();
	}
}

//fix site top margin:
function fixTopMargin(id) {
	var h = screen.height;
	var w = document.getElementById(id);
	if (w) {
		if (h > 768 && h < 900) {
			w.style.marginTop = "0px";
		} else if (h >900 && h < 1000) {
			w.style.marginTop = "50px";
		} else if (h >= 1024) {
			w.style.marginTop = "90px";
		}
	}
}
try {  document.execCommand('BackgroundImageCache', false, true);} catch(e) {}

