//** Dynamic Drive Equal Columns Height script v1.01 (Nov 2nd, 06)
//** http://www.dynamicdrive.com/style/blog/entry/css-equal-columns-height-script/

var ddequalcolumns=new Object()
//Input IDs (id attr) of columns to equalize. Script will check if each corresponding column actually exists:
ddequalcolumns.columnswatch=["sideColumn1", "sideColumn2", "content"]

ddequalcolumns.setHeights=function(reset){
var tallest=0
var resetit=(typeof reset=="string")? true : false
for (var i=0; i<this.columnswatch.length; i++){
if (document.getElementById(this.columnswatch[i])!=null){
if (resetit)
document.getElementById(this.columnswatch[i]).style.height="auto"
if (document.getElementById(this.columnswatch[i]).offsetHeight>tallest)
tallest=document.getElementById(this.columnswatch[i]).offsetHeight
}
}
if (tallest>0){
for (var i=0; i<this.columnswatch.length; i++){
if (document.getElementById(this.columnswatch[i])!=null)
document.getElementById(this.columnswatch[i]).style.height=tallest+"px"
}
}
}

ddequalcolumns.resetHeights=function(){
this.setHeights("reset")
}

ddequalcolumns.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
}

ddequalcolumns.dotask(window, function(){ddequalcolumns.setHeights()}, "load")
ddequalcolumns.dotask(window, function(){if (typeof ddequalcolumns.timer!="undefined") clearTimeout(ddequalcolumns.timer); ddequalcolumns.timer=setTimeout("ddequalcolumns.resetHeights()", 200)}, "resize")

var popUpWin=0;
function popUp(URLStr, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+'');
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function delLink(type,id) {
	if (document.getElementById(type+'_del'+id).value != 'true') {
		disableThis(type+'_rank'+id);
		disableThis(type+'_text'+id);
		disableThis(type+'_url'+id);
		if (type == 'll') {
			disableThis('ll_type'+id);
		}
		document.getElementById(type+'_del'+id).value = 'true';
	} else {
		enableThis(type+'_rank'+id);
		enableThis(type+'_text'+id);
		enableThis(type+'_url'+id);
		if (type == 'll') {
			enableThis('ll_type'+id);
		}
		document.getElementById(type+'_del'+id).value = 'false';
	}
}

function disableThis(id) {
	document.getElementById(id).readOnly = true;
	document.getElementById(id).style.color = '#AAAAAA';
}

function enableThis(id) {
	document.getElementById(id).readOnly = false;
	document.getElementById(id).style.color = '#000000';
}

function validatePasswds(id1,id2) {
	var pw1 = document.getElementById(id1).value;
	var pw2 = document.getElementById(id2).value;
	if (pw1.indexOf(' ') > -1) {
		alert("Spaces are not allowed in passwords.");
		return false;
	} else if ((pw1 == '') || (pw2 == '')) {
		alert("Please enter the new password twice.");
		return false;
	} else if ((pw1.length < 6) || (pw1.length > 12)) {
		alert("The new password length is invalid.");
		return false;
	} else if (pw1 != pw2) {
		alert("You did not enter the same new password twice.");
		return false;
	}
	return true;
}

function validateLoginName(id) {
	var loginName = document.getElementById(id).value;
	if (loginName.indexOf(' ') > -1) {
		alert("Spaces are not allowed in login names.");
		return false;
	} else if (loginName == '') {
		alert("Please enter a login name.");
		return false;
	}
	return true;
}

function checkOldPasswd(id) {
	if (document.getElementById(id).value == '') {
		alert("Please enter your current password.");
		return false;
	}
	return true;
}

function checkUser(id) {
	if (document.getElementById(id).value == '') {
		alert("Please select a user.");
		return false;
	}
	return true;
}

function checkTitle(id) {
	if (document.getElementById(id).value == '') {
		alert("Please enter a page title.");
		return false;
	}
	return true;
}
