var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

function validateString(str,valid){
	var res=0;
	for(var n=0;n<str.length;n++){ res+=(valid.indexOf(str.substring(n,n+1))<0)?1:0; }
	return (res>0) ? false:true;
}

String.prototype.isValidEmail=function(){
		return !!this.match(/^([a-zA-Z0-9]{1}([a-zA-Z0-9\.\-\_]*)[a-zA-Z0-9]{1})@([a-zA-Z0-9]{1}([a-zA-Z0-9\.\-\_]*)[a-zA-Z0-9]{1})\.([a-zA-Z]{2,4})$/)
	}

function showLayer(Id){
	if (document.all) {
		document.all[Id].style.visibility = "visible";
	} else if (document.layers){
		document.layers[Id].visibility = "show";
	} else if (document.getElementById){
		document.getElementById(Id).style.visibility = "visible";
	}
}
function hideLayer(Id){
	if (document.all) {
		document.all[Id].style.visibility = "hidden";
	} else if (document.layers){
		document.layers[Id].visibility = "hide";
	} else if (document.getElementById){
		document.getElementById(Id).style.visibility = "hidden";
	}
}

function gotourl(where) {
  location.href=where;
}

function setClassName(id, className) {
  var element;

  if(document.getElementById && (element = document.getElementById(id))) {
    element.className = className;
  }
}

function setTarget(what) {
  	document.getElementById('form_search').target=what;
}

function view_hide(id) {
	if (document.getElementById("span_" + id).style.display == 'none') {
		document.getElementById("span_" + id).style.display = "block";
	}
	else {
		document.getElementById("span_" + id).style.display = "none";
	}
} 

function view_inline(id) {
	if (document.getElementById("span_" + id).style.display == 'none') {
		document.getElementById("span_" + id).style.display = "inline";
		document.getElementById("viewmore_" + id).style.display = "none";
	}
	else {
		document.getElementById("span_" + id).style.display = "none";
	}
} 


function display(id) {
    	if (document.layers) {
    		current = (document.layers[id].display != 'block') ? 'block' : 'none'
    		document.layers[id].display = current;
    	} else if (document.all) {
    		current = (document.all[id].style.display != 'block') ? 'block'	: 'none';
    		document.all[id].style.display = current;
    	} else if (document.getElementById) {
    		current = (document.getElementById(id).style.display != 'block') ? 'block' : 'none';
    		document.getElementById(id).style.display = current;
        }
}
