function showBlock(id) {
	var el = document.getElementById(id);
	el.style.display = 'inherit';
	
}	

function hideBlock(id) {
	var el = document.getElementById(id);
	el.style.display = 'none';

}	



// POPUP WINDOW
var popwin=null;

function popup(popupURL,popupWidth,popupHeight,popupLeft,popupTop){
	popupLeft=(screen.width-popupWidth)/2;
	popupTop=(screen.height-popupHeight)/2;
	var args='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=NO,resize=no,width='+popupWidth+',height='+popupHeight+',left='+popupLeft+',top='+popupTop;
	if(popwin && !popwin.closed) popwin.close();
	popwin=window.open(popupURL,'',args);
}

// IMAGE ROLLOVER AND PRELOADER
function newImage(arg){
	if(document.images){
		rslt=new Image();
		rslt.src=arg;
		return rslt;
	}
}

function changeImages(){
	if(document.images && (preloadFlag==true)){
		for(var i=0;i<changeImages.arguments.length;i+=2){
		document[changeImages.arguments[i]].src=changeImages.arguments[i+1];
		}
	}
}

// LAUNCH EXTERNAL LINKS THAT ARE XHTML STRICT COMPLIANT
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";
	}
}

// HIGHLIGHT FORM FIELDS WITH FOCUS FOR EASIER USE
var highlightcolor="#c8e9a7"

var ns6=document.getElementById&&!document.all
var previous=''
var eventobj

//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which){
	if(which.style&&intended.test(which.tagName)){
		if(ns6&&eventobj.nodeType==3)
			eventobj=eventobj.parentNode.parentNode
			return true
		}
	else
	return false
}

//Function to highlight form element
function highlight(e){
	eventobj=ns6? e.target:event.srcElement
	if(previous!=''){
		if(checkel(previous))
			previous.style.backgroundColor=''
			previous=eventobj
				if(checkel(eventobj))
					eventobj.style.backgroundColor=highlightcolor
				}
		else{
	if(checkel(eventobj))
		eventobj.style.backgroundColor=highlightcolor
		previous=eventobj
	}
}

function noEnter(e) {

	// This limitation should only apply to text fields, 
	// not textareas which do not submit a form via enter 
	// and in fact need to allow returns in their input
	if ( window.event ) {
		if ( window.event.srcElement.type == 'text' || window.event.srcElement.type == 'password' ) {
			return window.event.keyCode != 13;
		} else {
			return true;
		}
	}

}
// REMOVE DOTTED UNDERLINES FROM IMAGES
function customImageLinks(){
	if(!document.getElementsByTagName) return;
	var anchors=document.getElementsByTagName('a');
	for(var i=0;i<anchors.length;i++){
		anchor=anchors[i];
		var images=anchor.getElementsByTagName('img');
		if(images[0]!=null){
			anchor.className+=anchor.className?" image":"image";
		}
	}
	if(window.addEventListener) window.addEventListener("load",customImageLinks,false);
}

// INITIATE IMAGE LINKS NO BORDER
window.onload=function(){
	customImageLinks();
}

