isFullScreen = new Boolean(false);
function appendTitle	(title) { 
	document.title = document.title + " - " + title; 
}
function thisMovie(movieName)
{
	if (navigator.appName.indexOf("Microsoft") != -1) return window[movieName];
    else return document[movieName];
}
function LookBook_InitComplete()
{
	thisMovie("LookBook").LookBook_SetBookData("lookbook.xml");	
}
function LookBook_CloseHandler()
{
	alert("Close LookBook");
}
function LookBook_GoFullScreen()
{
	setSWFScreen();
}
function setSWFScreen()
{
	isFullScreen = !isFullScreen;
	if (!isFullScreen)
	{
		thisMovie("LookBook").width = $jq144(window).width()-100;
		thisMovie("LookBook").height = $jq144(window).height();
		
		var margin = ((thisMovie("LookBook").width-730)/2);
		thisMovie("LookBook").style.marginLeft = (margin*-1)+"px";		
		thisMovie("LookBook").style.marginTop = "-160px";				
		$jq144('<div id="overlay1">')
		.css({
			position: 'absolute',
			top: 0,
			left: 0,
			height: $jq144(document).height(),
			width: '100%',
			zIndex: 1000  
		})
		.appendTo(document.body);	
		$jq144(".lookbook_wrap").css({zIndex : '1001'});			
	}
	else
	{
		thisMovie("LookBook").width = 730;
		thisMovie("LookBook").height = 375;
		
		$jq144("#overlay1").remove();
		thisMovie("LookBook").style.marginLeft = "0px";			
		thisMovie("LookBook").style.marginTop = "0px";						
		$jq144(".lookbook_wrap").css({zIndex : '70'});				
	}
	thisMovie("LookBook").LookBook_SetSWFScreen(thisMovie("LookBook").width, thisMovie("LookBook").height);
}

function WebSpecial_CloseHandler()
{
	$jq144("#overlay1").html("");
	$jq144("#overlay1").remove();
}

$jq144(document).ready(function(){
	// Home rollove blocks
	$jq144("#apparel-block, #news-block, #fuse-block").hover(
		function(){
			$jq144(this).find(".rollover").fadeIn();
		},
		function(){
			$jq144(this).find(".rollover").fadeOut();		
		}		
	);
	
	//Home slider
	$jq144('#home-slider').cycle({
		fx: 'fade', 
		timeout: 6000, 
	    prev:    '.slider-prev',
	    next:    '.slider-next',
	    pager:   '.slider-pager',
	    pagerAnchorBuilder: function(idx, slide) { 
			return '<a href="#"></a>'; 
		} 			
	});
	
        //Team slider
	$jq144('#team-slider').cycle({
		fx: 'fade', 
		timeout: 6000, 
	    prev:    '.team-slider-prev',
	    next:    '.team-slider-next',
	    pager:   '.team-slider-pager',
	    pagerAnchorBuilder: function(idx, slide) { 
			return '<a href="#"></a>'; 
		} 			
	});

	//Menu
	
	$jq144("#menu1 .level-1").hover(
		function(){
			$jq144(this).find("ul.level-2").slideToggle();
			$jq144(this).find(".red-arrow").css({marginTop: "-4px"}).toggle();			
		}			
	);
	
	$jq144("#menu1 .level-2 li").hover(
		function(){
			var pos = $jq144(this).position();
			if(pos.top == 7) pos.top = 0;
			$jq144(this).parent().parent().find(".red-arrow").animate({marginTop: pos.top-4+"px"}, {queue:false});			
		},
		function(){}		
	);	
	
	$jq144("#menu1 .level-2 li li").hover(
		function(){
			var pos1 = $jq144(this).parent().parent().position();
			var pos2 = $jq144(this).position();
			$jq144(this).parent().parent().parent().parent().find(".red-arrow").animate({marginTop: pos1.top+pos2.top+10+"px"}, {queue:false});			
		},
		function(){}		
	);		
	
	$jq144(".sizechart").click(function(){
	
		$jq144('<div id="overlay1">')
		.css({
			position: 'absolute',
			top: 0,
			left: 0,
			height: $jq144(document).height(),
			width: '100%',
			zIndex: 1000  
		})
		.appendTo(document.body); 

	
		$jq144('<div id="sizechart_block">')
		.css({
			position: 'absolute',
			top: 0,
			left: 0,
			cursor: 'pointer',
			width: $jq144("#sizechart").width(),
			height: $jq144("#sizechart").height()
		})
		.html($jq144("#sizechart").html())
		.appendTo($jq144("#overlay1"))
		.bind("click", function(){
			$jq144(this).parent().remove();
		})
		.center(); 

		return false;
	});
	
	$jq144("#web-special, #web-special1").click(function(){
		$jq144('<div id="overlay1">')
		.css({
			position: 'absolute',
			top: 0,
			left: 0,
			height: $jq144(document).height(),
			width: '100%',
			zIndex: 1000  
		})
		.appendTo(document.body); 
		
		$jq144('<div id="web-special-wrap">')
		.css({
			position: 'absolute',
			top: 0,
			left: 0,
			cursor: 'pointer',
			width: '1043px',
			height: '624px'
		})
		.appendTo($jq144("#overlay1"))
		.center(); 		
		
		$jq144('<div id="web-special-object">').appendTo($jq144("#web-special-wrap"));
		
		var webspecial = new FlashObject("/flash/WebSpecial.swf", "WebSpecial", "1043", "624", "8", "");
		webspecial.addParam("wmode", "transparent");
		webspecial.addParam("quality", "high");												
		webspecial.addParam("allowScriptAccess", "always");			
		webspecial.addParam("allowFullScreen", "true");		
		if($jq144(this).hasClass("apex")){
		webspecial.addVariable("dataPath", "/assets/externalData/xml/apexData.xml");			
		}else{		
		webspecial.addVariable("dataPath", "/assets/externalData/xml/data1.xml");	
		}
		webspecial.write("web-special-object");				
							
		return false;
	});		
	
});
