function FlashControl(ClsId,Url,Width,Height,AutoStart)
{
	document.write('<object classid="' + ClsId + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + Width + '">')
	document.write('<param name="movie" value="' + Url + '">')							  
	document.write('<param name="wmode" value="Opaque">')
	document.write('<param name="quality" value="high">')
	document.write('<embed src="' + Url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + Width + '" wmode="Opaque"></embed>')
	document.write('</object>')
}

/* Generic check newsletter function*/
function newsletterForm(theForm) {
  allCorrect=true ;
  
  if (theForm.name.value=="" ||
    theForm.email.value=="" ||
    theForm.strSubscriberLastName.value == "" ||
    theForm.strSubscriberCompany.value == "" ||
    theForm.strSubscriberCompanyPosition.value == "" ||
    theForm.strSubscriberAddress.value == "" ||
    theForm.strSubscriberCity.value == "" ||
    theForm.strSubscriberState.value == "" ||
    theForm.strSubscriberPostcode.value == "" ||
    theForm.strSubscriberCountry.value == "" ||
    theForm.strSubscriberPhoneWork.value == "") {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}
/* Generic check emailtofriend function*/
function emailtofriendForm(theForm) {
  allCorrect=true ;
  
  if (theForm.Name.value=="" ||
    theForm.Email.value=="" ||
    theForm.FriendName.value == "" ||
    theForm.FriendEmail.value == "") {
    allCorrect=false ;
  }
  if (allCorrect==false)
  {
    alert("Please fill in all fields marked *") ;
	return false ;
  } 
    return true ;
}

/* Generic check email function*/
function checkEmail(emailAddy) {
  if (emailAddy.value.length==0)
  {
    return true ;
  }
  if (emailAddy.value.indexOf("@",0) < 1 || emailAddy.value.indexOf(".",0) < 1)
  {
    alert("Please check the field:\n The email address appears incorrectly formed") ;
    emailAddy.focus() ;
	return false ;
  }
  return true ;
}

/* Function to check if year is valid ie. Initial value of "Year" or otherwise it must be a   numeric. Don't worry if the person believes they are a few centuries old! */
function checkYear(numberField) {
  allNumeric=true ;
  if (numberField.value.length==0 || numberField.value=="Year")
  {
    return true ;
  }

  for (i=0 ; i<numberField.value.length ; i++)  {    checkChar=numberField.value.charAt(i) ;
    if (checkChar<'0' || checkChar>'9')
	{
	  allNumeric=false ;
	}  
  }
  
  if (allNumeric==false)
  {
    alert("Please check the field:\n Only numbers permitted");
	numberField.focus() ;
	return false ;
  }
  
  return true ;
}

/* generic check for number(ie 0-9) */
function checkNumber(numberField) {
  allNumeric=true ;
  if (numberField.value.length==0)
  {
    return true ;
  }

  for (i=0 ; i<numberField.value.length ; i++)  {    checkChar=numberField.value.charAt(i) ;
    if (checkChar<'0' || checkChar>'9')
	{
	  allNumeric=false ;
	}  
  }
  
  if (allNumeric==false)
  {
    alert("Please check the field:\n Only numbers permitted");
	numberField.value = "";
	numberField.focus(numberField);
	return false ;
  }
  return true ;
}

/* generic phone number checker allowing brackets for prefix */
function checkPhone(phoneField) {
  allNumeric=true ;
  if (phoneField.value.length==0)
  {
    return true ;
  }
  
  for (i=0 ; i<phoneField.value.length ; i++)  {    checkChar=phoneField.value.charAt(i) ;
    if (checkChar!=' ' && checkChar!='\(' && checkChar!='\)'  && (checkChar<'0' || checkChar>'9') )
	{
	  allNumeric=false ;
	}  
  }
  
  if (allNumeric==false)
  {
    alert("Please check the field:\n Only numbers, spaces and \(\) permitted");
	phoneField.focus() ;
	return false ;
  }
  return true ;
}

//confirm delete message
function confirmDelete(theMessage,theDirect) {
  if( confirm(theMessage) ) {
    canClose = false;
 	document.location.replace(theDirect);
  }
}

function myfunc()
{
	document.location.href=document.fmSearch.strSearchType.options[document.fmSearch.strSearchType.selectedIndex].value + "?strKeyword=" + document.fmSearch.strKeyword.value;
	return false;
}

function activate(showthis, iconshow, iconhide){
		if (document.getElementById(showthis).style.display == '')
			document.getElementById(showthis).style.display = 'none';
		else
			document.getElementById(showthis).style.display = '';
			
		if (iconshow != null){
			document.getElementById(iconshow).style.display = '';
			document.getElementById(iconhide).style.display = 'none';
		}
	}
	function initialise(hidethis, display){
		if (display == 'hide'){
			//alert(hidethis);
			document.getElementById(hidethis).style.display = 'none';
		}
		if (display == 'show'){
			//alert(hidethis);
			document.getElementById(hidethis).style.display = '';
		}
	}

//function used for currency change
function menudirect(curchange){
var URL = document.curchange.currencyid.options[document.curchange.currencyid.selectedIndex].value;
window.location.href = URL;
}

function killAutofill(){
  is = document.getElementsByTagName("INPUT");
  for(i=0;i<is.length;i++)
    is[i].style.backgroundColor = "";
  ss = document.getElementsByTagName("SELECT");
  for(i=0;i<ss.length;i++)
    ss[i].style.backgroundColor = "";
}

//Newsletter subscribe form
function focusName(element) {
  if (element.value == " name...") {
    element.value = "";
  }
}

function blurName(element) {
  if (element.value == "") {
    element.value = " name...";
  }
}

function focusEmail(element) {
  if (element.value == " email...") {
    element.value = "";
  }
}

function blurEmail(element) {
  if (element.value == "") {
    element.value = " email...";
  }
}

function checkName(str)
{
        var vname = str
		if (vname == " name...")
             return false;
        if (vname == "")
             return false;
        return true;
}
function ValidateForm()
{
        if (!checkName(document.theForm.name.value)){
                alert("Please enter your first name.");
                return false;
        }
		if (!checkEmail(document.theForm.email)){
                //alert("Please enter a valid email address.");
                return false;
        }
	return true;
}

//netscape css fix

function WM_netscapeCssFix() {
   if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight) {
    document.location = document.location;
  }
}

function WM_netscapeCssFixCheckIn() {
  if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
    if (typeof document.WM == 'undefined'){
      document.WM = new Object;
    }
    if (typeof document.WM.WM_scaleFont == 'undefined') {
      document.WM.WM_netscapeCssFix = new Object;
      document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
      document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
    }
    window.onresize = WM_netscapeCssFix;
  }
}

WM_netscapeCssFixCheckIn()

//popup windows for references

function popupWindow(referenceHTML, w, h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	windowProperties = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,resizable'
	reference = window.open(referenceHTML, 'refName', windowProperties)
	if (parseInt(navigator.appVersion) >= 4) { reference.window.focus(); }
}
function newWindow(referenceHTML) {
	reference = window.open(referenceHTML, 'refName');
	if (parseInt(navigator.appVersion) >= 4) {
	    reference.window.focus();
	}
}