function domIt() {
	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";
		anchor.title = (anchor.title != "") ? anchor.title+" (opens in a new window)" : "opens in a new window";
		anchor.className = (anchor.className != '') ? anchor.className+' external' : 'external';
		}
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "popup") {
			anchor.onclick = function() {
				var pictitle = escape(this.title.replace(" (opens in a popup window)",""));
				//url = escape(this.getAttribute("href"));
				url = this.getAttribute("href");
				window.open(url,'popup','width=760,height=480,resizable=yes,scrollbars=yes');
				return false;
			  }
			anchor.title = (anchor.title != "") ? anchor.title+" (opens in a popup window)" : "opens in a popup window";
		}
	}
	//End anchors
	/*var hr = document.getElementsByTagName("hr");
	for (var i=0; i<hr.length; i++) {
		var newhr = hr[i];
		var wrapdiv = document.createElement('div');
		wrapdiv.className = 'hr';
		newhr.parentNode.replaceChild(wrapdiv, newhr);
		wrapdiv.appendChild(newhr);
	}*/
	TJK_quote();
}

/*	dynamicCSS.js v1.0 <http://www.bobbyvandersluis.com/articles/dynamicCSS.php>
	Copyright 2005 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

function createStyleRule(selector, declaration) {
	if (!document.getElementsByTagName || !(document.createElement || document.createElementNS)) return;
	var agt = navigator.userAgent.toLowerCase();
	var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_iewin = (is_ie && (agt.indexOf("win") != -1));
	var is_iemac = (is_ie && (agt.indexOf("mac") != -1));
	if (is_iemac) return; // script doesn't work properly in IE/Mac
	var head = document.getElementsByTagName("head")[0]; 
	var style = (typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", "style") : document.createElement("style");
	if (!is_iewin) {
		var styleRule = document.createTextNode(selector + " {" + declaration + "}");
		style.appendChild(styleRule); // bugs in IE/Win
	}
	style.setAttribute("type", "text/css");
	style.setAttribute("media", "screen"); 
	head.appendChild(style);
	if (is_iewin && document.styleSheets && document.styleSheets.length > 0) {
		var lastStyle = document.styleSheets[document.styleSheets.length - 1];
		if (typeof lastStyle.addRule == "object") { // bugs in IE/Mac and Safari
			lastStyle.addRule(selector, declaration);
		}
	}
}

function cnt(w,x,sep){
	var y=w.value;
	var r = 0;
	a=y.replace(/\s/g,' ');
	a=a.split(sep);
	for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}
	x.value=r;
}

function 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
function setElementStyleByClassName(cl, propertyName, propertyValue) {
	if (!document.getElementsByTagName) return;
	var re = new RegExp("(^| )" + cl + "( |$)");
	var el = document.all ? document.all : document.getElementsByTagName("body")[0].getElementsByTagName("*"); // fix for IE5.x
	for (var i = 0; i < el.length; i++) {
		if (el[i].className && el[i].className.match(re)) {
			el[i].style[propertyName] = propertyValue;
		}
	}
}

function myUnobtrusiveBehavior() {
	setElementStyleByClassName("toggle", "display", "none"); // fallback for IE5/Mac
	setElementStyleByClassName("toggle", "display", "block");
}

function openCentWindow(theURL,scrollb,winWidth,winHeight) { //v2.0
	
	if (winWidth>screen.width){winWidth = screen.width;}
	if (winHeight>screen.height){winHeight = screen.height;}
	if (winWidth <= 0){winWidth = screen.width;}
	if (winHeight <= 0){winHeight = screen.height;}

	leftPos = 0; leftPos = screen.width/2 - winWidth/2; // centres window
	topPos = 0; topPos = screen.height/2 - winHeight/2;  // centres window
	
	modWindow = window.open(theURL,'modWin','toolbar=no,location=no,scrollbars='+scrollb+',resizable=yes,width='+winWidth+',height='+winHeight+',left='+leftPos+',top='+topPos+'');
	modWindow.focus();
}

function TJK_quote(){// v1.1.2 Copyright (c) 2006 TJKDesign - Thierry Koblentz
// use the same paths for: SRC and STYLE (filter) attributes
// set top padding values to match the height of your images
// you may style both images using CSS: blockquote img {...}
// or individually using classes:  .q_O {...} and .q_C {...}
if (!document.getElementsByTagName || !document.createElement) return;
	var z_Q=document.getElementsByTagName("blockquote");
	for (var x=0;x<z_Q.length;x++){
	var q_O = document.createElement('img');
	q_O.alt="";
	q_O.src="/css/images/quote.gif";
	//q_O.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',src='/img/q_O.png')";
	if (document.all) q_O.style.paddingTop="2px";	
	q_O.style.verticalAlign="text-top";	
	q_O.className="q_O";	
	var q_C = document.createElement('img');
	q_C.alt="";
	q_C.src="/css/images/unquote.gif";	
	//q_C.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',src='/img/q_C.png')";
	if (document.all) q_C.style.paddingTop="2px";	
	q_C.style.verticalAlign="text-bottom";	
	q_C.className="q_C";		
	z_Q[x].getElementsByTagName("p")[0].insertBefore(q_O,z_Q[x].getElementsByTagName("p")[0].firstChild)
	z_Q[x].getElementsByTagName("p")[0].appendChild(q_C);
	var z_URL=z_Q[x].getAttribute("cite");
	if (z_URL){
		var z_DIV = document.createElement('div');
		var z_FROM = document.createTextNode("Quote from: ");
		z_Q[x].appendChild(z_DIV);
		z_DIV.className="q_D";
		var z_A = document.createElement('a');
		var z_DOMAIN = document.createTextNode(z_URL.slice(z_URL.indexOf("//")+2,z_URL.indexOf("/",9)));
		z_A.href=z_URL;
		z_A.appendChild(z_DOMAIN);
		z_DIV.appendChild(z_FROM);
		z_DIV.appendChild(z_A);
		}
	}
}
function confirmSubmit() {
var agree=confirm("Are you sure you wish to continue?");
if (agree)
	return true ;
else
	return false ;
}

function submitform(theform) {
  if (!document.getElementById) return;
  var myform = document.getElementById(theform);
  myform.submit();
}

function showe(eleId) {
	if (!document.getElementById) return;
		var ele = document.getElementById(eleId);
		if (ele) {
			if (ele.style.display != 'block') {
				ele.style.display = 'block';
			} else {
				ele.style.display = 'none';
			}
		} else {
			return false;
		}
}