// JavaScript Document

browserBypass = false;

currentImgPath = "";
currentSwfPath = "";
currentName = "";
currentWidth = "";
currentHeight = "";
currentPlayer = "";

if (BrowserDetect.browser == "Safari" && BrowserDetect.version == "312.6") {
	browserBypass = true;
}

jQuery(document).ready(function($) {
	if (screen.width < 1024) {
	
	}
})

function slideshow(index,num) {
	viewportWidth = 820; 
	workBlock = "#scroll"+index;
	$(workBlock).stop().animate({left:-(viewportWidth*num)},1500, 'easeInOutCubic');
	temp = $(workBlock).parent().parent();
	temp2 = $(temp).find(".workText");
	temp3 = $(temp2).find("li");
	i = 0;
	temp3.each(function(){
		$(this).find("a").removeClass("selected");
		$(this).find("a").addClass("");
		if (i == num) {
			$(this).find("a").addClass("selected");
		}
		i++;
	});
}

function profile(num) {
	if (browserBypass == false) {
		viewportWidth = 820; 
		$("#profileList").stop().animate({left:-(viewportWidth*num)},150, 'easeInOutCubic');
		
		temp = $(".rightcol").children().children();
		i = 0;
		temp.each(function(){
			
			currentItem = $(this).text();
			$(this).removeClass("selected");
			lastChr = currentItem.charCodeAt(currentItem.length-1);
			if (lastChr == 8212) {
				newText = currentItem.substr(0,currentItem.length-2);
				$(this).text(newText);
			}

			if (i == num) {
				$(this).append(" &mdash;");
				$(this).addClass("selected");
			}
			i++;
		});
	}
}

function videoControl(imgpath, swfpath, width, height, playerNum) {

	videoFinish();
	
	currentImgPath = imgpath;
	currentSwfPath = swfpath;
	currentName = "fp"+playerNum;
	currentWidth = width;
	currentHeight = height;

	
	
	
	var so = new SWFObject(swfpath, "fp"+playerNum, width, height, "7", "#000000");
	so.addParam("wmode", "transparent");
	so.write("player"+playerNum);
	currentPlayer = playerNum;
	
	
}

function videoFinish(){
	$("#player"+currentPlayer).html("<a href=\"#\" onClick=\"videoControl('"+ currentImgPath +"', '"+ currentSwfPath +"', '"+ currentWidth +"', '"+ currentHeight +"','"+ currentPlayer +"'); return false;\"><img src=\""+ currentImgPath +"\" alt=\"\" width=\""+ currentWidth +"\" height=\""+ currentHeight +"\" /></a>");
	content.focus();
}
