﻿var isIE = false; var Ie5 = false; var Ie6 = false; var Ie5up = false; 
var Ns6 = false; var Fox = false;
if (navigator.appName.indexOf("Netscape") != -1) {
	if (navigator.userAgent.indexOf("Firefox") != -1)
		Fox = true;
	else
		Ns6 = true;
}
else if (navigator.appName.indexOf("Explorer") != -1) {
  if (navigator.userAgent.indexOf("MSIE 6") != -1) Ie6 = true;
  if (navigator.userAgent.indexOf("MSIE 5") != -1) Ie5 = true;
  if (Ie5 || Ie6) {Ie5up = true ;isIE = true;}
}

function rndDate(){
	return "&rnd=" + escape(new Date());
}

function removeEl(el){
var node = getEl(el);
node.parentNode.removeChild(node);
}

function getEl(value){
if (document.getElementById(value)){
var el = document.getElementById(value);
return el;
}else{window.status = (value + ' element not found.')}
}
function setOn(v){if (getEl(v).style.display !="block") {getEl(v).style.display = "block";}}
function setOff(v){if (getEl(v).style.display !="none") {getEl(v).style.display = "none";}}
function setClass(v,c){
if (document.getElementById(v)){var el = document.getElementById(v).className = c;}
else{window.status = (v + ' element not found. (trying to set class:' + c + ')')}
}
function el_exists(id) {
	if(document.getElementById(id)!= null){return true;}else {return false;}
}
function unSelect(id,type){
if (el_exists(id)){
var el = getEl(id);
if (isIE){
	switch (type){
		case 0: el.onselectstart = function () { eSrc = event.srcElement;eType = eSrc.type;if (eType != 'text' ){return false;} }; break;
		case 1: el.onselectstart = function () { eSrc = event.srcElement;eType = eSrc.type;if (eType != 'text' && eType != 'a' && eType != 'textarea' && eType != 'file' && eType != 'password'){return false;} };break;
	  }
}else{el.style.mozUserSelect = "none";}
}
}

function clearStatus(){
window.status = "";
}

function openWindow(URL,theTarget,wide,high) {
leftPos = (screen.width) ? (screen.width-wide)/2 : 0; topPos = (screen.height) ? (screen.height-high)/2 : 0;
return window.open(URL,'','height='+high+',width='+wide+',left='+leftPos+',top='+topPos+',status=yes,toolbar=0,menubar=0,location=0,resizable=1,border=0,scrollbars=1',true);
}

function openWindowNoResize(url,theTarget,wide, high) {
	if (isIE){
		high = parseInt(high) + 20;
	}
	leftPos = (screen.width) ? (screen.width-wide)/2 : 0; topPos = (screen.height) ? (screen.height-high)/2 : 0;
	window.open(url,'','height='+high+',width='+wide+',left='+leftPos+',top='+topPos+',status=no,toolbar=0,menubar=0,location=0,resizable=0,border=0',true);
}

function _attachEvent(oName,sEvent,fn) {
		if (document.all) {
			sEvent = "on" + sEvent;
			oName.attachEvent(sEvent,fn);
		}else {
			if (sEvent == "mouseenter") sEvent = "mouseover";
			if (sEvent == "mouseleave") sEvent = "mouseout";
			oName.addEventListener(sEvent,fn,false);
		}
}

function refreshPage(){
	window.location = window.location + "?rnd=" + escape(new Date());	
}

function clearMozStatus(){
if (!isIE){
	getEl('blank_iframe').src = "about:blank";
}
}


sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function checkDisableBtn(){
	if(document.MM_returnValue){
		document.getElementById('submitBtn').disabled=true;
		document.getElementById('submitBtn').value='Processing, please wait...';
	}
}
