// JavaScript Document

function doGetById(i) {
	var o = null;
	if (document.getElementById && document.getElementById(i) != null)
		o = document.getElementById(i);
	else if (document.layers && document.layers[i] != null)
		o = document.layers[i];
	else if (document.all)
		if (document.all[i] != null) {
			o = document.all[i];
		}
	return o;
}

function doSetClass(i, s) {
	var o = doGetById(i);
	o.className = s;
}

function doSetImage(i, s) {
	var o = doGetById(i);
	o.src = s;
}

function setDisplay(id, v) {
	if ( v==0 ) { v='none'; }
	if ( v==1 ) { v='block'; }
	if ( (v!='block') && (v!='none') ) { v==null }
		
	if (document.getElementById) {
		if (document.getElementById(id) != null) {
			if (v==null) {
				if (document.getElementById(id).style.display == "none") { v = 'block'; } 
				else { v = 'none'; }
			} document.getElementById(id).style.display = v;
		}
	} else { 
		if (document.layers) {	
			if ( v==null ) {
				if (document.id.display == "none"){ v = 'block'; } 
				else { v = 'none'; }
			} document.id.display = v;
		} else {
			if ( v==null ) {
				if (document.all.id.style.visibility == "none"){ v = 'block'; } 
				else { v = 'none'; }
			} document.all.id.style.display = v;
		}	
	}
	
	if (v == null) { return -1; }
	if (v == 'none') { return 0; }
	if (v == 'block') { return 1; }
	
}



// External Links
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
	   anchor.getAttribute("rel") == "external")
	 anchor.target = "_blank";
 }
}
window.onload = externalLinks;	



// Confirm delete
function confirmdelete(u){
	if( confirm('Are you sure you wish to delete this item?') ){
		window.location = u;
	}
}



// Opens location on click
function openLocation(f){
	if(f != '0'){
		window.location = f;
		//document.window.location(f);
		return false;
	}
}

	