// JScript File
function Load() {

//alert(navigator.userAgent.toLowerCase());
if (deviceHasFlash()){
window.onunload = function() {
     window["__flash__removeCallback"] = function (instance, name) {
     return;
     };
	 }
    var flashvars = { StrapCount: 11,
        BackCount: 11,
        WorkCount: 10,
        ThePath: location.href
    };
    var params = { menu: "false", wmode: "transparent" };
    var attributes = {};
    swfobject.embedSWF("/swf/player_two.swf", "playertwo", "766", "346", "7.0.0", "", flashvars, params, attributes);


    $('.page-title').flash(
        {
            src: '/flash/fonts/museo500v2.swf',
            flashvars: {
                css: [
                    '* {color:#434343;font-size:31;text-align:right;letter-spacing: -1},'
                ].join(' ')
            }
        },
        { version: 7 },
        function(htmlOptions) {
            $(this).attr({ style: 'padding:0;margin:0 0 0 -4px' })
            htmlOptions.flashvars.txt = this.innerHTML;
            this.innerHTML = '<span>' + this.innerHTML + '</span>';
            var $alt = $(this.firstChild);
            htmlOptions.wmode = 'transparent';
            htmlOptions.height = $alt.height();
            htmlOptions.width = $alt.width() + 10;
            $alt.addClass('sifr-alt');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));
        }
    );
	
   $('.spotlights h3').each(function(i) {
        var txt = this.innerHTML;
        this.innerHTML = "<span id='ff" + i + "'>" + this.innerHTML + "</span>";
        var $alt = $(this.firstChild).clone();
        $alt.removeAttr("id");
        $(this).append($alt);
        var height = height="60px";
        var width = $alt.width();
        $alt.addClass('sifr-alt');
        $(this).attr({ style: 'padding:0;margin:0 0 0 5px;min-height:55px;height:auto !important;height:55px;' })
		.mouseleave(function(event) { callExternalInterface("ff" + i, txt); });

        var flashvars = { css: escape("* {margin:0;margin-bottom:15px;letter-spacing: -1;leading:1.0em;color: #E45B0B;font-size:19} a:hover { color: #E45B0B; text-decoration: underline; }"), txt: escape(txt) };
        var params = { menu: "false", wmode: "transparent", SWLiveConnect: "true", allowScriptAccess: "always" };
        var attributes = { id: "ff" + i, name: "ff" + i };
        swfobject.embedSWF("/flash/fonts/museo500v2.swf", "ff" + i, width, height, "7.0.0", "", flashvars, params, attributes);
    }
    );
    function getMovieName(movieName) {
        if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName] }
        else { return document[movieName] }
    }
    function callExternalInterface(swfID, text) { getMovieName(swfID).callRedraw(text) }
	
} 
else{
		 $('.case-study').each(function() {
        var current = location.href
        if (current.indexOf($(this).attr('href')) != -1) {
            $(this).toggleClass("case-study_selected");

        }
        else {
            $(this)
					.mouseover(function(event) {
	//				    $(this).animate({ width: "191px", height: "52px",
	//				        marginLeft: "-2px", marginTop: "-2px"
	//				    }, { duration: 100, queue: false });
					});
            $(this).mouseout(function(event) {
    //            $(this).animate({ width: "189px", height: "50px",
    //                marginLeft: "0px", marginTop: "0px"
     //           }, { duration: 100, queue: false });
            });
        }


    });
	$("#slideShow").jFlow({
        slides: "#slides",
        controller: ".jFlowControl", // must be class, use . sign
        slideWrapper: "#jFlowSlide", // must be id, use # sign
        selectedWrapper: "jFlowSelected",  // just pure text, no sign
        easing: "swing",
        width: "388px",
        height: "287px",
        duration: 400,
        prev: ".jFlowPrev", // must be class, use . sign
        next: ".jFlowNext" // must be class, use . sign
    });
	}
}

function deviceHasFlash(){
	//return false
	var _devicetype = navigator.userAgent.toLowerCase()
	return !((_devicetype.indexOf("win64") != -1) || (_devicetype.indexOf("iphone")!= -1)|| (_devicetype.indexOf("ipad")!= -1)|| (_devicetype.indexOf("ipod")!= -1))
}
