﻿var current_id = window.location.pathname.split("/")[2],
	flashVersion = swfobject.getFlashPlayerVersion();
flashVersion = flashVersion.major;
function homepageFlash() {
	if(flashVersion > 8) {
		var flashvars = {}
		var params = { 
			base: ".",
			quality: "best",
			allowfullscreen: "false",
			wmode: "transparent"
		}                
		var attributes = {}
	
		swfobject.embedSWF("/images/ca-slideshow-header.swf", "flashObject", "920", "388", "9.0.0", false, flashvars, params, attributes);
	}
	else { upgradeFlash() };
};


function portfolioFlash(PO_ID) {
    if(flashVersion > 8) {
		var flashvars = {}
		var params = { 
			base: ".",
			quality: "best",
			allowfullscreen: "false",
			wmode: "transparent"
		}                
		var attributes = {}
	
		swfobject.embedSWF("/images/ca-portfolio-header.swf?PO_ID=" + PO_ID, "flashObject", "920", "459", "9.0.0", false, flashvars, params, attributes);
	}
	else { upgradeFlash() };
};

function upgradeFlash() {
	var flashLink = $(document.createElement("a")).attr("href","http://get.adobe.com/flashplayer/").attr("target","_blank").html("You need to upgrade your version of flash to view this content properly.<br />Click here to upgrade now.");
	$("#flashObject").addClass("noFlash").append(flashLink);
};

$(function(){
	searchInp = $("#searchText");
	searchText = searchInp.val();
	searchInp.focus(function(){
		if($(this).val() == searchText)
			$(this).val("");
	});
	searchInp.blur(function(){
		if($(this).val() == '' || $(this).val() == null)
			$(this).val(searchText);
	});
});
