﻿
function MM_openBrWindow(theURL,winName,features) {window.open(theURL,winName,features);}
String.prototype.trim = function(){return this.replace(/(^\s*)|(\s*$)/g, "");}

function checkEmail(checkThisEmail){
var myEMailIsValid = true;
var myAtSymbolAt = checkThisEmail.indexOf('@');
var myLastDotAt = checkThisEmail.lastIndexOf('.');
var mySpaceAt = checkThisEmail.indexOf(' ');
var myLength = checkThisEmail.length;
if (myAtSymbolAt < 1 ){myEMailIsValid = false}
if (myLastDotAt < myAtSymbolAt){myEMailIsValid = false}
if (myLength - myLastDotAt <= 2){myEMailIsValid = false}
if (mySpaceAt != -1){myEMailIsValid = false}
   return myEMailIsValid
}

function emptyField(textObj){
	if (textObj.value.length == 0) return true;
	for (var i=0; i<textObj.value.length; i++) {
		var ch = textObj.value.charAt(i);
		if (ch != ' ' && ch != '\t') return false;	
	}
	return true;	
}

function LoadIMG(siteUrl){
    document.getElementById('captcha_numchar').src=siteUrl+'global/captcha.asp?'+Date();
}
function getNumbers(){var ch=event.keyCode;event.returnValue =((ch >= 48 && ch <= 57) || ch ==46);}

function CheckFields_contact(obj,site_url){
	var doc=window.document;
	if (obj.firstName.value==''){alert('Please fill in the "Name"'); obj.firstName.focus(); return false;}
	if (obj.email.value==''){alert('Please fill in the "Email"');obj.email.focus();return false;}
    if (obj.email.value!=''  && !checkEmail(obj.email.value)){alert('The "email" address is not in the correct format');obj.email.select();return false;}
    if (obj.phone.value==''){alert('Please fill in the "Phone"'); obj.phone.focus(); return false;}
    if (obj.captchacode.value==''){alert('Please fill in the "Code"');obj.captchacode.focus();return false;}
    return true;
}

function onclick_picture(picFile,picNumber){
   if (document.images['picture_Big'] && picFile!=''){
      if (document.all){
           document.images['picture_Big'].style.filter="blendTrans(duration=1)";
           document.images['picture_Big'].filters.blendTrans.Apply();
       }
       document.images['picture_Big'].style.visibility='hidden';
	   document.images['picture_Big'].src = picFile;
	   document.images['picture_Big'].style.visibility='visible';		
       if (document.all){
           document.images['picture_Big'].filters.blendTrans.Play();
        }
       if (picNumber!=''){
           changeHTML('SlideImageId',picNumber);
       }
   }
   return false;
}

function changeHTML(spanId,code){
    var element = document.getElementById(spanId);
	if(element) {
	    element.innerHTML = unescape(code);
	}
}
function gallery_picture(picFile){
   if (document.getElementById('picture_Big') && picFile!=''){
      if (document.all){
           document.getElementById('picture_Big').style.filter="blendTrans(duration=1)";
           document.getElementById('picture_Big').filters.blendTrans.Apply();
       }
       document.getElementById('picture_Big').style.visibility='hidden';
	   document.getElementById('picture_Big').src = picFile;
	   document.getElementById('picture_Big').style.visibility='visible';		
       if (document.all){
           document.getElementById('picture_Big').filters.blendTrans.Play();
        }
   }
   return false;
}
