function popWin(pagename,iWidth, iHeight)

{

window.open(pagename,null,'Width=' + iWidth + ',height=' + iHeight + ',resize=yes,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');

}


function confirmDeletion()
{
var agree=confirm("Are you sure you want to delete this item?");
if (agree)
	return true ;
else
	return false ;
}


function createTooltips() {

	var links = document.links || document.getElementsByTagName('a');

	var n = links.length;

	for (var i = 0; i < n; i++) {

		if (links[i].title && links[i].title != '') {
			// add the title to anchor innerhtml
			links[i].innerHTML += '<span>'+links[i].title+'</span>';
			links[i].title = ''; // remove the title
		}
	}
}

function rollit(imageName, state){

	i = 'images/' + imageName + '_' + state + '.gif';

	document.images[imageName].src= i;
}


//check for required fields in a form

function required(which) {
	var pass=true;
	var passw=true;
	if (document.images) {
		for (i=0;i<which.length;i++) {
		var tempobj=which.elements[i];
			if (tempobj.id=="*password1" &&
					document.getElementById("*password1").value != document.getElementById("*password2").value) {
					passw=false;
	       }
			if (tempobj.id.substring(0,1)=="*"||tempobj.id.substring(tempobj.id.length-1,1)=="*") {
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&
					tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
					tempobj.selectedIndex==0)) {
					pass=false;
					break;
	         }
	      }
	      
	   }
	}
	if (!pass) {
		alert("Please enter your "+tempobj.name+".");
	return false;
	}
	if (!passw) {
		alert("The passwords do not match!");
	return false;
	}
	else
	
return true;
}



//redirect login to the calling page

function redirectLogin() {
	
    document.loginform.action = document.referrer;
    try {
    document.loginform2.action = document.referrer;
	}
	catch(err)	{
	}
}



function clearLogoutQS() {

  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == "logout") {
      return pair[1];
    }
    window.location = "";
  }

}

