<!-- Hide script from older browsers

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) xx.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// return y position, minus
function getLayerX($objname) {
	$x = event.clientX;
	//$objW = MM_findObj($objname).width;
	//$x = document.body.clientWidth - $objW - 10;
	return $x;
}

// return y position, minus
function getLayerY($objname) {
	//$y = event.clientY;
	$objH = MM_findObj($objname).height;
	$y = (event.clientY - $objH);
	return $y;
}

//checks content is only numbers
function isNumeric( str ) {
	if (str.match(/[^0-9.]/)) {
		return true;
	}
	return false;
}

//checks if field is empty
// ex.
//    if( isEmpty( form.FIELDNAME ) ){
//        alert( 'ID <> 7 caracteres...?' );
//        //form.FIELDNAME.focus();
//        return false;
//    }

//checks if field is empty
function isEmpty(str){ 
    strRE = new RegExp( ); 
    strRE.compile( '^[s ]*$', 'gi' ); 
    return strRE.test( str.value ); 
} 

// Checks to see if email address is 'valid' 
function notValidEmail( str ){ 
   mailRE = new RegExp( ); 
   mailRE.compile( '^[._a-z0-9-]+@[.a-z0-9-]+[.]{1}[a-z]{2,4}$', 'gi' ); 
   return !(mailRE.test( str.value )); 
} 

//checks content is only letters
function isLetters( str ) {
	var myregexp = new RegExp("[^a-zA-Z]");
	if (str.match(myregexp)) {
		return true;
	}
	return false;
}

//checks content is only uppercase letters
function isUppercaseLetters( str ) {
	var myregexp = new RegExp("[^A-Z]");
	if (str.match(myregexp)) {
		return true;
	}
	return false;
}

//checks content is only uppercase letters or spaces
function isUppercaseLettersOrSpaces( str ) {
	var myregexp = new RegExp("[^A-Z] ");
	if (str.match(myregexp)) {
		return true;
	}
	return false;
}

//checks content is only numbers and lowercase letters
function isNumbersAndLowercaseLetters( str ) {
	var myregexp = new RegExp("[^a-z0-9]");
	if (str.match(myregexp)) {
		return true;
	}
	return false;
}

//checks content is only numbers and letters
function isNumbersAndLetters( str ) {
	var myregexp = new RegExp("[^a-zA-Z0-9]");
	if (str.match(myregexp)) {
		return true;
	}
	return false;
}

//checks content is only numbers
function isPhoneNumber( str ) {
	if (str.match(/[^0-9+ ]/)) {
		return true;
	}
	return false;
}

//checks content is only numbers
function isNumbers( str ) {
	if (str.match(/[^0-9]/)) {
		return true;
	}
	return false;
}

//checks content is numeric
function isNumeric( str ) {
	if (str.match(/[^0-9.]/)) {
		return true;
	}
	return false;
}

//checks if box is ticked
function notChecked( box ){
    if( box.checked ){
        return false;
    }
    else{
        return true;
    }
}

// =========================================================================================
// application specific

function checkLogIn( form, msg1, msg2, msg3 ){
    if( isEmpty( form.user_em ) ){
        alert(msg1);
        form.user_em.focus();
        return false;
    }
    if( notValidEmail( form.user_em ) ){
        alert(msg1);
        form.user_em.focus();
        return false;
    }
    if( isEmpty( form.key ) ){
        alert(msg2);
        form.key.focus();
        return false;
    }
    if ( form.captcha_input != null) {
    	if( isEmpty( form.captcha_input ) ){
        	alert(msg3);
        	form.captcha_input.focus();
        	return false;
        }
    }
}

// ===================================================================================================

function y2k(number) { return (number < 1000) ? number + 1900 : number; }

// checks if date passed is in valid dd/mm/yyyy format

function isValidDate (myDate,sep) {
    if (myDate.length == 10) {
        if (myDate.substring(2,3) == sep && myDate.substring(5,6) == sep) {
            var date  = myDate.substring(0,2);
            var month = myDate.substring(3,5);
            var year  = myDate.substring(6,10);
            var test = new Date(year,month-1,date);
            if ( year == y2k(test.getYear() ) && ( month-1 == test.getMonth() ) && ( date == test.getDate() ) ) {
                return true;
            }
            else {
                //alert('valid format but invalid date');
                return false;
            }
        }
        else {
            // alert('invalid separators');
            return false;
        }
    }
    else {
        // alert('invalid length');
        return false;
    }
}

// ================================================================================================================

function highlightthumb(myimg, onoff, sitecolor) {
	// alert(\'test\' + myimg);
	var myimgobj = MM_findObj(myimg);
	if (onoff == "on") {
		myimgobj.style.border = "solid " + sitecolor + " 2px";
		return null;
	}
	if (onoff == "off") {
		myimgobj.style.border = "solid #ffffff 2px";
		return null;
	}
	return null;
}

// ================================================================================================================
// resist right click script is now stored separately in norc.js
// ================================================================================================================

//End hiding script from older browsers -->
