function flashLoader(flashMovie, flashVars, flashHeight, flashWidth, flashAlign, flashQuality, flashBGColor, flashID) {
	var flashPluginSpace = 'http://www.macromedia.com/go/getflashplayer';
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="' + flashWidth + '" HEIGHT="' + flashHeight + '" id="' + flashID + '" ALIGN="' + flashAlign + '">');
	document.write('<PARAM NAME="FlashVars" VALUE="' + flashVars + '">');
	document.write('<PARAM NAME="movie" VALUE="' + flashMovie + '">');
	document.write('<PARAM NAME="quality" VALUE="' + flashQuality + '">');
	document.write('<PARAM NAME="bgcolor" VALUE="' + flashBGColor + '">');
	document.write('<param name="wmode" value="transparent">');
	//document.write('<PARAM NAME="wmode" VALUE="opaque">');
	document.write('<EMBED src="' + flashMovie + '" quality="' + flashQuality + '" bgcolor="' + flashBGColor + '"  WIDTH="' + flashWidth + '" HEIGHT="' + flashHeight + '" NAME="' + flashID + '" ALIGN="' + flashAlign + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="' + flashPluginSpace + '" FlashVars="' + flashVars + '" wmode="transparent"></EMBED>');
	document.write('</OBJECT>');
}

function OpenWindow(url,name,w,h){
	window.open(url,name,'width='+w+',height='+h);
}

function closeSelf() {
    window.open('','_parent','');
    window.opener = top;        
    window.close();
}

//function checkEmail(emailElm) {
//	var email = emailElm.value;
//	if(!(/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(email))) {
//		return false;
//	} else {
//		return true;
//	}	
//}

function checkEmail(emailCtrl) {
    var email = emailCtrl.value;
    return checkEmailStr(email);
}

function checkEmailStr(email) {
    if(!(/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/.test(email))) {
		return false;
	} else {
		return true;
	}	
}

function checkEmpty(ctrl) {
    if (ctrl.value.length > 0)
        return true;
    else
        return false;
}

function checkAllowedChars(ctrl) {
	var regularExpression  =  /<|>/;
	var result = regularExpression.test(ctrl.value);
	if (result) 
		return false;
	else
		return true;
}

function checkDate(dateElm) {
	var date = dateElm.value;
	if(!(/^([1-9]|0[1-9]|1[012]|)\/([1-9]|0[1-9]|[12][0-9]|3[01])\/(19|20)\d\d/.test(date))) {
		return false;
	} else {
		return true;
	}	
}

function checkOfferPrice(offerElm) {
	var offer = offerElm.value;
	if(!(/^(\$)?([0-9]+|[0-9]{1,3}(,[0-9]{3})*)$/.test(offer))) {
		return false;
	} else {
		return true;
	}	
}

// Standard
function trim(str) {
  var i,j;
  i = 0;
  j = str.length - 1;
  str = str.split("");
  while(i < str.length) {
    if(str[i]==" ") {
      str[i] = ""
    } else {
      break;
    }
    i++;
  }
  while(j > 0) {
    if(str[j]== " ") {
      str[j]=""
    } else {
      break;
    }
    j--;
  }
  return str.join("");
}

function remove(str) {
}

/* !!! All the Page specific functionality please put below */


/*  Site map and google should be moved to proper lib */
/* Begin code for SiteMap mouseover popup */
function googleMapSubmit() {
	s0 = document.getElementById('tmpAddr');
	s1 = document.getElementById('tmpAddr1');
	s2 = document.getElementById('tmpAddr2');
	s0.value = s1.value + ', ' + s2.value;
}

var delay=null;
var delaySecs=500;
var current=null;

function isIE6() {
	version = 0;
	if (navigator.appVersion.indexOf("MSIE") != -1) {
		tempVer = navigator.appVersion.split("MSIE");
		version = parseFloat(tempVer[1]);
	}
	return (version == 6) ? true:false
}

function mX(evt) {
	if (evt.pageX) return evt.pageX;
	else if (evt.clientX) return evt.clientX + (document.documentElement.scrollLeft ?
	   document.documentElement.scrollLeft :
	   document.body.scrollLeft);
	else return null;
}

function mY(evt) {
	if (evt.pageY) return evt.pageY;
	else if (evt.clientY) return evt.clientY + (document.documentElement.scrollTop ?
	   document.documentElement.scrollTop :
	   document.body.scrollTop);
	else return null;
}

function onSiteMapHover(l, evt) {
	var div = document.getElementById('siteMapPopUp');
	if (current==l.href) return;
	if (delay) clearTimeout(delay);
	SiteMapShow(l,evt,div);
	return;
}

function SiteMapShow(l,evt,div) {
	current = l.href;
	div.style.top = mY(evt) - parseInt(div.style.height) - 27 + 'px';
	div.style.left = mX(evt) + 'px';
	if (isIE6()) {
		// Hide Action Control
		var layer = document.getElementById('invActionBarBottom');
		if (layer != null) {
			layer.style.display = 'none';
		}
		var layer = document.getElementById('invActionBarBottomHolder');
		if (layer != null) {
			layer.style.display = 'block';
		}
	}
	return;
}

function SiteMapHide() {
	var div = document.getElementById('siteMapPopUp');
	div.style.top = -600 + 'px';
	div.style.left = -600 + 'px';
	if (isIE6()) {
		// Show Action Control
		var layer = document.getElementById('invActionBarBottom');
		if (layer != null) {
			layer.style.display = 'block';
		}
		var layer = document.getElementById('invActionBarBottomHolder');
		if (layer != null) {
			layer.style.display = 'none';
		}
	}
	return;
}

function onSiteMapOut() {
	current = null;
	delay = setTimeout('SiteMapHide()', delaySecs);
	return;
}
/* End code for SiteMap mouseoverpopup */