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 popuper = window.open(newURL, 'popup','scrollbars=0, resizeable=0, width=425, height=550');
  popuper.window.focus();
}
function rand(min,max){
	var $min = min;
	var $max = max + 1;
	random_num = Math.floor($min + ($max-$min)*Math.random());
	return random_num;
}
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+$/,"");
}
function writeEmail(act,url){
	var email = act + "@" + url;
	var html = "<a href='mailto:" + email + "'>" + email + "</a>";
	document.write(html);
}

$(document).ready(function(){
	//external link setup
	$("a[href^='http://']").each(function(){
		$(this).attr({
			href: "javascript:visit('" + $(this).attr('href') + "')"
		});
	});
	//background rollovers setup
	$(".rollover:not(.current)").hover(
		function () {
			var h = "0px -" + $(this).css("height");
			$(this).css("background-position",h);
		},
		function () {
			$(this).css("background-position","0px 0px");
		}
	);
	$(".current").each(function(){
		var h = "0px -" + $(this).css("height");
		$(this).css("background-position",h);
	})
	//dropdown setup
	$("#mainmenu li").hover(
		function(){
			$(this).contents("ul").css("display","block");
		},
		function(){
			$(this).contents("ul").css("display","none");
		}
	);
	$("ul.submenu").each(function(){
		$(this).contents("li:last").css("border","none");
	});
	$("ul.submenu li").each(function(){
		var $w = $(this).parent().width();
		$(this).css("width",$w);
	})
});
