/*
* name: ui.global.js
* author: RAJF
* notes: global ui functions and config
*/

/*
* ## INTERNAL VARS ##
*/
var _debug;
var _arrowLocation;
var _params = {};
var _attributes = {};
var _flashFileUrl;
var _ie6;
/*
* ## END INTERNAL VARS ##
*/

/*
* ## CONFIG ##
*/
// Log to Firebug Console, set to false for Live!
_debug = true;
_imageLocation = "/images/";
_flashLocation = "/flash/";
// cookie name
_cookiename = "panelSettings"
/* swf object */
_params.scale = "noscale";
_params.salign = "tl";
_params.swliveconnect = "true";
_params.allowscriptaccess = "always";
/*
* ## END CONFIG ##
*/

/*
* window onload function
*/
$(function() {

    // custom font
    Cufon.replace('#main-navigation a', { fontFamily: 'Eurostile' });

    //swfobject.embedSWF(_flashLocation + "home_banner.swf", "banner", "771", "243", "9.0.0", false, {xmlUrl:_flashLocation + "home_banner_config.xml"}, _params, {id:"home_banner"});

    //_ie6 = false /*@cc_on || @_jscript_version < 5.7 @*/;

    // add corners
    /*if (!_ie6)
    {
    $(".module").not(".whats_new").corner("bottom");
    }*/

    // Tabs
    $('#contact-us ul').show();
    $('#contact-us').tabs().find("h2").hide();

    // add submit class for ie6
    //$('input[type=submit]').addClass("submit");
    /*$('input[type=submit]').addClass("ui-state-default ui-corner-all").hover(
    function(){ 
    $(this).addClass("ui-state-hover"); 
    },
    function(){ 
    $(this).removeClass("ui-state-hover"); 
    }
    );*/

    // remove ui classes for custom tabs
    $('#contact-us').removeClass("ui-widget ui-widget-content ui-corner-all");

    // for some reason, jBreadcrumb gives an 'undefined' error in IE6..
    // i've turned this off for now, until I can sort it out correctly
    // edit: actually.. doing an alert(typeof jBreadcrumb) gives undefined in
    // all browsers.. so newer browsers must be clever enough to catch that error and
    // deal with it accordingly..  
    if (typeof jBreadcrumb != "undefined") {
        $(".breadcrumb").jBreadCrumb({ easing: 'swing', previewWidth: '25' });
    }


});

// log to firebug console
function debug(message)
{
	if(_debug) if (window.console) console.log(message);
}

/*
* open windows in external window
*/ 
function setLinkRel()
{
  $('a[rel="external"]').click( function() {
      window.open( $(this).attr('href') );
      return false;
  });
}

// blurring on DHTML elements which shouldn't have the dotted outline
// use: $('a.noblur').nb();
$.fn.nb = function() {
	return this.focus(function(){
	this.blur()
	});
}

function setupFlvPlayer(width, height, containerID, thumbURL, flvURL)
{
  var params = {};
  params.allowfullscreen = "true";
  if (thumbURL.length > 0) {
    swfobject.embedSWF(_flashLocation + "player_timecode.swf", containerID, width, height, "9.0.0", false, { thumbnail: thumbURL, flvUrl: flvURL }, params, { id: containerID });
  } else {
    swfobject.embedSWF(_flashLocation + "player_timecode.swf", containerID, width, height, "9.0.0", false, { flvUrl: flvURL }, params, { id: containerID });
  }
}