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 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 = min;
	var $max = max + 1;
	random_num = Math.floor($min + ($max-$min)*Math.random());
	return random_num;
} 


$(document).ready(function() {
	
	//dropdown setup
	$("#gMenu li:has(ul)").hover(
		function(){
			$(this).css("cursor","pointer");
			$("ul", this).css("display","block");
			$("#iNav").fadeOut("fast");
		},
		function(){
			$("ul", this).css("display","none");
			$("#iNav").fadeIn("slow");
		}
	);
	$("li.spacer").prev().children("a").css("marginBottom","0px");
	
	//iNav setup
	
	$("#iNav li:not(.nada)").hover(
		function(){
			$(this).css("backgroundPosition","0px -38px");
		},
		function(){
			$("#iNav li:not(.current)").css("backgroundPosition","0px 0px");
		}
	).click(function(){
		$("#iNav li.current").removeClass("current").css("backgroundPosition","0px 0px");
		$(this).addClass("current").css("backgroundPosition","0px -38px");
		var $i = $(this).prevAll("li:not(.nada)").length;
		$("#gWrap").stop().scrollTo( $("#gallery li:eq("+$i+")" ), {speed:500, axis:"x", offset:{top:0, left:-275}} );
	});
	
	//image setup
	$("#gallery li:first").css("marginLeft","275px");
	$("#gallery li").click(function(){
		var $i = $(this).prevAll().length;
		$("#iNav li").css("backgroundPosition","0px 0px");
		$("#iNav li:not(.nada)").eq($i).css("backgroundPosition","0px -38px");
		$("#gWrap").stop().scrollTo( $("#gallery li:eq("+$i+")" ), {speed:500, axis:"x", offset:{top:0, left:-275}} );
	});
	
});// /document.ready

//gallery setup

function gallerySetup(){
	var $width = 275;
	$("#gallery li").each(function(){
		var $x = parseInt($(this).width());
		$width += $x;
	});
	//$x = $("#gWrap").width() - $("#gallery li:last").width() - 275;
	//$width += ( $x > 0 )?$x:0;
	$("#gallery").css("width",$width);
}

$(window).load(function() {
	gallerySetup();
});

$(window).resize(function() {
	gallerySetup();
});