
	function checkBrowser(){
		this.ver=navigator.appVersion
		this.dom=document.getElementById?1:0
		this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
		this.ie4=(document.all && !this.dom)?1:0;
		this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
		this.ns4=(document.layers && !this.dom)?1:0;
		this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
		return this
	}
	bw=new checkBrowser()

// 	toggles in/visible tables
	//Shows the div
	function show(div,nest){
		obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
		obj.visibility='visible';
		obj.zIndex='10';
	}
	//Hides the div
	function hide(div,nest){
		obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
		obj.visibility='hidden';
	}

	
//	sets cookies (not used currently)
	function setCookie(name, value, expires, path, domain, secure) {
		var navigation = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
		document.cookie = navigation;
	}
	
	
//	prevents Buttons from being hit twice
	function disableButton() {
		document.loginForm.submitButton.disabled=true;
		return true;
	}
// Window transitions
function windowOpener(url, name, args) {
	if (typeof(window.popupWin) != "object") {
		window.popupWin = window.open(url,name,args);
	}
	else {
		if (!window.popupWin.closed) {
			window.popupWin.close();
			window.popupWin = window.open(url,name,args);
			// popupWin.location.href = url;
		}
		else {
			window.popupWin = window.open(url,name,args);
			// window.popupWin.focus();
		}
	}
}
function popUp(page, title, width, height, lights, x, y) {
	var x = 100, y = 100;
	day = new Date();
	id = day.getTime();
	var href = "/pop_up.mg?page="+page+"&title="+title+"&lights="+lights;
	windowOpener(href, id, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height+',top='+y+',left='+x);
}
function switchWindow(target) {
	if (opener.closed) {
		window.open(target);
		self.close();        
	}
	else {
		opener.location.href = target;
		opener.focus();
		self.close();
	}
}
function closeWindow() {
	if (!opener.closed) {
 		opener.focus();
		self.close();
    }
	self.close();
}
function reSize(w,h) {
	var x = 0, y = 0;
	if (document.all) {
		x = screen.width - w - 50;
		y = 30;
	}
	else if (document.layers) {
		x = window.outerWidth - w - 50;
		y = 30;
	}
	else if (document.getElementById) {
		x = window.outerWidth - w - 50;
		y = 30;
	}
	else {
		x = 30;
		y = 30;
	}
	window.resizeTo(w,h)
	window.moveTo(x,y)
}

   var remote;
   function uploadStatus() {
   		remote = window.open("","uploadstatus","width=450,height=400,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes");
    	remote.location.href = "http://www.smugmug.com/photos/uploadstatus.mg";
        	if (remote.opener == null) remote.opener = window; 
    	remote.opener.name = "opener";
    }
    
    function uploadStatusKill() {
  
    	remote = window.open("","uploadstatus","width=350,height=400,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes");
    	remote.close();
    	
    }


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 showElms(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 = "visible";
        }
}
