
// Example:
// simplePreload( '01.gif', '02.gif' ); 
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

function swap (imgName,swapTo) {
	document.images[imgName].src = swapTo;
	}
	
function rollover (imgName) {
	s = document.images[imgName];
	if (s.src.indexOf("_over") > 0) {
		s.src = s.src.replace(/_over/,"");
	} else {
		if (s.src.indexOf(".jpg") > 0) {
			s.src = s.src.replace(/\.jpg/,"_over.jpg");
		}
		if (s.src.indexOf(".gif") > 0) {
			s.src = s.src.replace(/\.gif/,"_over.gif");
		}
	}
}
	
function show(divname) {
	document.getElementById(divname).style.display = "block";
	}
	
function hide(divname) {
	document.getElementById(divname).style.display = "none";
	}
	
function toggle(divname) {
	d = document.getElementById(divname+"_info");
	if (d.style.display == "block") {
		d.style.display = "none";
	} else {
		d.style.display = "block";
	}
	d = document.getElementById(divname);
	if (d.innerHTML.indexOf("click to open") > -1) {
		temp = d.innerHTML.replace(/click to open/,"click to close");
	} else {
		temp = d.innerHTML.replace(/click to close/,"click to open");
	}
	d.innerHTML = temp; 
	init();
}

function fixFlash() {
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}

$(document).ready(function(){
	// position contact box
	$("#contact").css("marginTop", ($(document).height() - $("#left-column").height() - 11) + "px");
	
	// fade submenus
	$(".submenu").hide();
	
	// position submenus, enter them into arrays
	$("li").each(function (el) {
		if ($(this).children(".submenu").length > 0) {						
			$(this).children(".submenu").css("left", ($(this).offset().left + 237) + "px");
			$(this).children(".submenu").css("top", $(this).offset().top + "px");
//			menus[$(this).next(".submenu").attr("id").substr(8)] = false;
//			submenus[$(this).next(".submenu").attr("id").substr(8)] = false;
		}
	});
	
	// submenus
	$("li").hoverIntent(function() {
		$(this).children(".submenu").children(".shadow").css("backgroundImage", "url(images/submenu-shadow.png)");		
		$(this).children(".submenu").fadeIn(1);
	},
	function() {
		$(this).children(".submenu").children(".shadow").css("backgroundImage", "none");
		$(this).children(".submenu").fadeOut(300);
	}
	);
		
	// bubble
	/*
	$("#bubble").hide();
	$().mousemove(function(e){
    	$("#bubble").css("left", (e.pageX + 15) + "px");
		$("#bubble").css("top", (e.pageY) + "px");
   	}); 
	$(".services_thumb").hover(function() {
		$("#bubble").html("view larger image and more info");
		$("#bubble").fadeIn(100);
		$("#bubble").fadeTo("fast", .8);
	},
	function() {
		$("#bubble").fadeOut(300);
	}
	);
	*/
	
});

