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';
document.write(html);
}
function visit(newURL) {
	var site = window.open(newURL, 'website','scrollbars=1, resizable=1, location=1, menubar=1, status=1, toolbar=1, height=768, width=1024');
	site.window.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.isEmpty = function(){
	if (val.match(/^s+$/) || val == ""){ return true;}
	else{return false;} 
}
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.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;
}
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; 
	}
}
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;
}
function verticalCenter(target){
	var wH = $(window).height();
	var oH = $(target).height();
	var mH = "-" + Math.floor(oH/2) + "px";
	
	if ( wH <= oH ){
		$(target).css({
			top: "10px",
			marginTop: "0px"
		});
	}
	else{
		$(target).css({
			top: "50%",
			marginTop: mH
		});
	}
}
function clearSelection() {
   var sel ;
   if(document.selection && document.selection.empty){
     document.selection.empty() ;
   } else if(window.getSelection) {
     sel=window.getSelection();
     if(sel && sel.removeAllRanges)
       sel.removeAllRanges() ;
   }
}

function getPageName(){
	var l = window.location.pathname;
	var z = l.lastIndexOf("/")+1;
	var p = l.slice(z);
	var r = l.slice(0,z);
	if( p == "" ){ p = r }
	return p;
}
//siteSpecific

