/**
 * Main application scripts
 * @name default.js
 * @package CC
 * @version 1.0
 * @since 2010-01-01
 * @author Cristian Ciobanu <cristian@pallasweb.com>
 */

// Raise a popup
function openWindow(url,width,height) {day = new Date();id = day.getTime();window.open(url, id, "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width="+width+",height="+height+",left="+((screen.width - width)/2)+",top="+((screen.height - height)/2));return false;}

// Open links in a new window
function externalLinks() {if (!document.getElementsByTagName) return;var anchors = document.getElementsByTagName("a");for (var i=0; i<anchors.length; i++) {var anchor = anchors[i];if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")anchor.target = "_blank";}}

// Turns a tag into a link
function href(url) {window.location = url;return false;}

// Some hosts like to inject other libraries and JQuery does not like this
jQuery.noConflict();

// We can proceed now
jQuery(document).ready(function() {
    browserDetection();
    fixIE6alphaTransparency();
    externalLinks();
    if (jQuery('#home-swf').length == 1) {
        flashembed("home-swf", {src: "assets/media/v1.swf", wmode: 'transparent'});
    }
    if (jQuery('#home-swf-1').length == 1) {
        flashembed("home-swf-1", {src: "assets/media/v2.swf", wmode: 'transparent'});
    }
	if (jQuery('.scrollable').length > 0) {
		jQuery('.scrollable').scrollable({
			size:1,
			clickable:false,
			item:'.item',
			speed:800
		});
	}
});
