function writeFlash(url,w,h,id,bg,trans) {
var html = "";
html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="' + w + '" height="' + h + '" id="'+ id + '">\n';
html += '<param name="movie" value="' + url + '" />\n';
html += '<param name="quality" value="high" />\n';
html += '<param name="bgcolor" value="' + bg + '" />\n';
html += '<param name="scale" value="noscale" />\n';
if (trans == 1) {html += '<param name="wmode" value="transparent" />\n';}
html += '<!--[if !IE]> <-->\n';
html += '<object data="' + url + '" width="' + w + '" height="' + h + '" type="application/x-shockwave-flash" name="'+ id + '">\n';
html += '<param name="quality" value="high" />\n';
html += '<param name="scale" value="noscale" />\n';
html += '<param name="bgcolor" value="' + bg + '" />\n';
html += '<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" />\n';
if (trans == 1) {html += '<param name="wmode" value="transparent" />\n';}
html += ' FAIL (the browser should render some flash content, not this).\n';
html += ' </object>\n';
html += '<!--> <![endif]-->\n';
html += '</object>\n';
return html;
}
function visit(newURL) {
	var site = window.open(newURL);
	site.focus();
}
function popup(newURL) {
	var p = window.open(newURL, 'popup','scrollbars=0, resizeable=0, width=425, height=550');
	p.window.focus();
}
function popupPic(sPicURL) {
	var pp = window.open( "popup.html?"+sPicURL, "popupPic", "scrollbars=0, resizeable=1, width=425, height=550");
	pp.window.focus();
}
function rand(min,max){
	var $min,$max,random_num;
	$min = min;
	$max = max + 1;
	random_num = Math.floor($min + ($max-$min)*Math.random());
	return random_num;
}
String.prototype.decode = function(){
	return this.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,"\"");
}
String.prototype.decodeNoP = function(){
	return this.replace(/&lt;p&gt;/gi,"").replace(/&lt;\/p&gt;/gi,"<br /><br />").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,"\"");
	return this.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,"\"");
}
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
};
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
};
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
};
String.prototype.checkEmail = function(){
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(this)){ r = true }
	else{ r = false }
	return (r)
}
String.prototype.topLevelDir = function(){
	var dflt = "/";
	if ( this != "/" ){
		var ary = new Array();
		ary = this.split("/");
		if ( ary[1].indexOf(".") == -1 ){
			return ary[1];
		}
		else{
			return dflt; 
		}
	}
	else{
		return dflt; 
	}
}
String.prototype.fileName = function(){
	var dflt = "index.asp";
	if ( this != "/" ){
		var ary = new Array();
		ary = this.split("/");
		var n = ary.length - 1;
		if ( ary[n].indexOf(".") > 1 ){
			return ary[n];
		}
		else{
			return dflt; 
		}
	}
	else{
		return dflt; 
	}
}
String.prototype.pad = function(len, pad, dir) {
	var STR_PAD_LEFT = 1;
	var STR_PAD_RIGHT = 2;
	var STR_PAD_BOTH = 3;
	if (typeof(len) == "undefined") { len = 0; }
	if (typeof(pad) == "undefined") { pad = ' '; }
	if (typeof(dir) == "undefined") { dir = STR_PAD_RIGHT; }
 	var str = this; 
	if (len + 1 >= str.length) {
		switch (dir){
			case STR_PAD_LEFT:
				str = Array(len + 1 - str.length).join(pad) + str;
			break;
			case STR_PAD_BOTH:
				var right = Math.ceil((padlen = len - str.length) / 2);
				var left = padlen - right;
				str = Array(left+1).join(pad) + str + Array(right+1).join(pad);
			break;
			default:
				str = str + Array(len + 1 - str.length).join(pad);
			break;
		} // switch
	}
	return str;
}
Array.prototype.indexOf = function( v, b, s ) {
 for( var i = +b || 0, l = this.length; i < l; i++ ) {
  if( this[i]===v || s && this[i]==v ) { return i; }
 }
 return -1;
};
function getCookie(c_name){
	var c_start, c_end;
	if (document.cookie.length>0){
	  c_start = document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1){ 
	    c_start=c_start + c_name.length+1; 
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1){ c_end=document.cookie.length; }
	    return unescape(document.cookie.substring(c_start,c_end));
	    } 
	  }
	return false;
}
function setCookie(c_name,value,expiredays,path){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays===null) ? "" : ";expires="+exdate.toGMTString())+
	((path===null) ? "" : ";path="+escape(path));
}
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  }
  return false;
}
//siteSpecific

function submitNewsletterEmail(){
	var email = $("#newsletter_email_address").val();
	
	if ( email.checkEmail() ){
		var sendData = {
			email_address: email
		};
		
		$.getJSON('/_asp/email.is.registered.asp',{email: email},function(data){

			if( data.state == 'false'){
				$.ajax({
				  type: "GET",
				  url: "/_asp/process.verticalresponse.asp",
				  data: sendData,
				  dataType: "text",
				  error: function(){
				     	alert('Our site is experiencing difficulties, please check back later.');
				  },
				  success: function() {
						$("#newsletter_form").html("<img id=\"newsletter_thanks\" src=\"/_images/newsletter-thanks.png\" alt=\"\" />");
				  }
				});
			}
			else{
				$("#newsletter_email_address").val("Your already registered!");
			}
		});

	}
	else{
		$("#newsletter_email_address").css("background-image","url(/_images/newsletter-signup-bkd-error.png)");
	}
}
