// FORCE MATCHES THE HEIGHT OF TWO DIVS

function divMatchTwo(one,two) {   
if (document.getElementById(one)) {
var lh=document.getElementById(one).offsetHeight;
var rh=document.getElementById(two).offsetHeight;
var nh = Math.max(lh, rh);
document.getElementById(one).style.height=nh+"px";
document.getElementById(two).style.height=nh+"px";
}
}

// FORCE MATCHES THE HEIGHT OF THREE DIVS
function sortNum(a,b) { return b-a}
function divMatchThree(one,two,three) {
if (document.getElementById(one)) {
var obj=new Array(3);
var option=[one,two,three];
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height="auto";
obj[i]=document.getElementById(option[i]).offsetHeight;
nh=obj.sort(sortNum);
}
nh1=nh.splice(1,2);
for(var i=0; i<option.length; i++) {
document.getElementById(option[i]).style.height=nh+"px";
}
}
}

// CREATES A POP UP WINDOW

function sendtofriend(){
	popup("send2friend.php", 200, 200, 380, 235, 'no','no','no');	
}

var popUpWin=0;
function popup(URLStr, left, top, width, height, scrollflag, toolbar, resize)
{
  if (scrollflag == null) {
	  scrollflag = 'no';
  }
  
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar='+toolbar+',location=no,directories=no,status=no,menubar=no,scrollbars='+scrollflag+',resizable='+resize+',copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+', location=0');
}

function refreshMenu() {
	window.parent.leftFrame.location.reload();
}

// CROSS BROWSER GETELEMENTBYID ALTERNATIVE

function returnObjById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

// TURN A DIV VISIBLE

function showdiv(name) {
	div = returnObjById(name);
	div.style.visibility = 'visible';
}

// TURN A DIV INVISIBLE

function hidediv(name) {
	div = returnObjById(name);
	div.style.visibility = 'hidden';
}

// TOGGLE A DIV IF VISIBLITITY UNKNOWN... ON/OFF SWITCH

function togglediv(name) {
	
	div = returnObjById(name);
	if (div.style.visibility == 'hidden') {
		div.style.visibility = 'visible';
	} else {
		div.style.visibility = 'hidden';
	}
}

// STUFF FOR INPUT BOXES I THINK

function closediv(e, name) {
	
	div = returnObjById(name);
	
	var element;
	
	if (window.event){
		element = window.event.srcElement;
	}else if (e){
		element = e.target;
	}
	
	if (!e) var e = window.event;
	if (e.target){
		element = e.target;	} else {
		element = window.event.srcElement;
	}
	
	tagtype = element.tagName;
	
	if (div.style.visibility != 'hidden' && tagtype != 'A') {
		div.style.visibility = 'hidden';
	}
	
} 

function setIframeHeight(iframeName) {
  //var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if (iframeEl) {
  iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous
  //var docHt = getDocHeight(iframeWin.document);
  // need to add to height to be sure it will all show
  var h = alertSize();
  var new_h = (h-148);
  iframeEl.style.height = new_h + "px";
  //alertSize();
  }
}

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}



function mouseclicked(myfield,e)
{
	if (myfield.value.length > 0){
	   
   		if (myfield.id == "password") {
	   		myfield.type = 'password';
   		}
		
		if (myfield.value == myfield.name) {
			myfield.value = "";
   			myfield.focus();
   			return false;
		}
   }
else
   return true;
}