$(document).ready(function(){
	//ie menu hover fix
	checkHeight();
	if (window.attachEvent) {$("#nav li").hover(
		function(){$(this).addClass("iehover");},
		function(){$(this).removeClass("iehover");}
	);};
	//email functions
	$("span.sendmail").each(function(i) {
		//	username+domain+com+[display}
		var a = $(this).text().split("+");
		a[3] = a[3] || a[0]+"@"+a[1]+"."+a[2];
		$(this).text("").html('<a href="mailto:'+a[0]+'@'+a[1]+'.'+a[2]+'">'+a[3]+'</a>');
	});
	//show hide div
	$("div[id^='shd']").each(function(i) {$(this).hide();});
	$("a[id^='shd']").click(function(){
		var id = $(this).attr("id");
		id = id + "d";
		$("div[id^='shd']").not("#"+id).hide("fast");
		$("#"+id).show("fast");
		return false;
	});
	//toggle div
	$("div[id^='tog']").each(function(i) {$(this).hide();});
	$("h2[id^='tog']").click(function(){
		var id = $(this).attr("id");
		id = id + "d";
		$("div[id^='tog']").not("#"+id).hide("fast");
		$("#"+id).toggle("fast",function() {
			var pos = $("#"+id).offset();
			$("html, body").animate({scrollTop:(pos.top-100)+"px"},"fast");
		});
		return false;
	});
	//flash movies
	$("div.flashmov").each(function(i){
		// url+w+h
		var a = $(this).text().split("+"); 
		var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+a[1]+'" height="'+a[2]+'"><param name="movie" value="'+a[0]+'"> <param name="quality" value="high"><param name="wmode" value="transparent"><embed src="'+a[0]+'" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+a[1]+'" height="'+a[2]+'"></embed></object>';
		$(this).html(str);
	});
	$("div.flashvid").each(function(i){
		// FLV+SWF+SKIN+w+h+ID
		var a = $(this).text().split("+"); 
		var str = '<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="'+a[3]+'" height="'+a[4]+'" id="'+a[5]+'"><param name="movie" value="'+a[1]+'" /><param name="salign" value="lt" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="FlashVars" value="&MM_ComponentVersion=1&skinName='+a[2]+'&streamName='+a[0]+'&autoPlay=true&autoRewind=false" /><embed src="'+a[1]+'" flashvars="&MM_ComponentVersion=1&skinName='+a[2]+'&streamName='+a[0]+'&autoPlay=true&autoRewind=false" quality="high" scale="noscale" width="'+a[3]+'" height="'+a[4]+'" name="'+a[5]+'" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" /></object>';
		$(this).html(str);
	});
	//clear & replace text
	$("input.crt").each(function(){
		if ($(this).val()==="") {$(this).val($(this).attr("title"));}
	}).focus(function(){
		if ($(this).attr("title")===$(this).val()) {$(this).val("");}
		else {$(this).val($(this).attr("title"));}
	}).blur(function(){
		if ($(this).val()==="") {$(this).val($(this).attr("title"));}
	});
});

var checkHeight = function() {
	var h1 = $("#maincopy").height()+200;
	var h2 = $("#rightcol").height();
	var h3 = $("#leftcol").height();
	var h4 = (h1 > h2) ? h1 : h2;
	h4 = (h4 > h3) ? h4 : h3;
	if (h4) {$("#maincopy").css("height",h4+"px");}
	if (h4) {$("#rightcol").css("height",h4+"px");}
	if (h4) {$("#leftcol").css("height",h4+"px");}
};