$(document).ready(function(){  
	// Clear field value when clicked
	$(".has_default_value").focus(function(){
		if ( $(this).val() == $(this).attr("title") ) {
			$(this).val("");
		}
	});
	$(".has_default_value").blur(function(){
		if ( $(this).val() == "" ) {
			$(this).val($(this).attr("title"));
		}
	});
	// Open links in new window (or tab)
	$('a.new_window, .new_window a, div.item h3 a').click(function(){
		window.open(this.href);
		return false;
	});
	// Portfolio
	$("#accordion").accordion();	
	$('#tabs').tabs();
	$('#dialog_link').click(function(){
		$('#dialog').dialog('open');
		return false;
	});
	$('#dialog').dialog({
		autoOpen: false,
		width: 600,
		buttons: {
			"Ok": function() {
				$(this).dialog("close"); 
			},
			"Cancel": function() { 
				$(this).dialog("close"); 
			}
		}
	});
	$('#dialog_link, ul#icons li').hover(
		function() {
			$(this).addClass('ui-state-hover');
		},
		function() {
			$(this).removeClass('ui-state-hover');
		}
	);
	$("div.portfo_desc").hide();
	$("div.more_info").click(function(){
		$(this).next("div.portfo_desc").slideToggle(900);
	});
	// Remove focus outlines
	$("a").keypress(function(){
		this.blur();
		this.hideFocus = false;
		this.style.outline = null;
	});
	$("a").mousedown(function(){
		this.blur();
		this.hideFocus = true;
		this.style.outline = 'none';
	});
	// Rollovers
	$(".rollover").hover(function(){
		this.src = this.src.replace("_off.","_on.");
	},
	function(){
		this.src = this.src.replace("_on.","_off.");
	});		  
	$(".rollover").each(function(){
		source_image = $(this).attr("src");
		rename_image = source_image.replace(/_off\./gi, "_on.");
		$("<img>").attr("src", rename_image);
	});
	// SWFObject
	swfobject.embedSWF("/wp-content/themes/eventure_2009/flash/toobplayer_testimonials.swf", "flash_testimonial", "358", "232", "9", "/wp-content/themes/eventure_2009/flash/expressInstall.swf", {wmode: "opaque"});
	
	var flashvars = {};
	var params = {
	  wmode: "transparent",
	  scale: "noscale",
	  salign: "t",
	  quality: "high"	  
	};
	var attributes = {};

	swfobject.embedSWF("/wp-content/themes/eventure_2009/flash/background.swf", "flback", "100%", $(document).height(), "9.0.0","/wp-content/themes/eventure_2009/flash/expressInstall.swf", flashvars, params, attributes);

});