﻿
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 addbookmark(url){
var title="bird 2000";
if (window.sidebar) { // firefox
   window.sidebar.addPanel(title, url,"");
}else if(window.opera && window.print){ // opera
   var elem = document.createElement('a');elem.setAttribute('href',url);elem.setAttribute('title',title);elem.setAttribute('rel','sidebar');elem.click();
}else if(document.all)// ie
   window.external.AddFavorite(url, title);
}
function checkSearch(obj){if(obj.keySearch.value == ""){alert('Select the search words and press "search" ');obj.keySearch.focus();return false;}}


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){
	if (document.getElementById("LastName").value==''){alert('Fill in the required field "Last Name"'); document.getElementById("LastName").focus(); return false;}
	if (document.getElementById("phone").value==''){alert('Fill in the required field "Telephone"'); document.getElementById("phone").focus(); return false;}
	if (document.getElementById("email").value==''){alert('Fill in the required field "Email"');document.getElementById("email").focus();return false;}
    if (document.getElementById("email").value!=''  && !checkEmail(document.getElementById("email").value)){alert('E-mail address is incorrect,');document.getElementById("email").select();return false;}
    if (document.getElementById("captchacode").value==''){alert('Fill in the required field "Code"');document.getElementById("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;
}

