function hexaToDec(num){
	return parseInt(num,16);
}
function hexaToRGBpixastic(num){
	var value = num.split("#").join("");
	var r = value.substring(0,2);
	var g = value.substring(2,4);
	var b = value.substring(4,6);
	var rr = (hexaToDec(r)/255)-1;
	var gg = (hexaToDec(g)/255)-1;
	var bb = (hexaToDec(b)/255)-1;
	var result = [rr,gg,bb]
	return result;
}
function projectBoxRollover(target){
	var speed = 200;
	//alert($("#"+target.id+" #favIkOn").css("visibility"));
	if($("#"+target.id+" #favIk").css("visibility") == "visible"){
		$("#"+target.id+" #favIk").stop().animate({opacity:1},speed);
	}else{
		$("#"+target.id+" #favIk #circle2").css({visibility:"hidden"});
		$("#"+target.id+" #favIk #star2").css({visibility:"hidden"});
	}
	$("#"+target.id+" #shareIk").stop().animate({opacity:1},speed);
	//$("#"+target.id+" #client").stop().animate({opacity:1},speed);
	//$("#"+target.id+" #keywords").stop().animate({opacity:1},speed);
	$("#"+target.id+" #client").css({opacity:1});
	$("#"+target.id+" #keywords").css({opacity:1});
	$("#"+target.id+" #imgOn").stop().animate({opacity:1},speed);
}
function projectBoxRollout(target){
	var speed = 200;
	//if($("#"+target.id+" #favIk").css("visibility") == "visible"){
		$("#"+target.id+" #favIk").stop().animate({opacity:0},speed);
	//}
	$("#"+target.id+" #shareIk").stop().animate({opacity:0},speed);
	//$("#"+target.id+" #client").stop().animate({opacity:0},speed);
	//$("#"+target.id+" #keywords").stop().animate({opacity:0},speed);
	$("#"+target.id+" #client").css({opacity:0});
	$("#"+target.id+" #keywords").css({opacity:0});
	$("#"+target.id+" #imgOn").stop().animate({opacity:0},speed);
}
function onloadProjectBox(target,color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function tintPNG(target,color){
	var rgb = hexaToRGBpixastic(color);	
	$(target).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function onloadProjectBoxImgOff(target){
	$(target).animate({opacity:1},550);
}
function projectBoxClick(slag){
	//alert(slag);
}
function newsRBoxRollover(target){
	var speed = 150;
	//$("#"+target.id+" #titleOn").stop().animate({opacity:1},1);
	//$("#"+target.id+" #readmoreOn").stop().animate({opacity:1},1);
	//$("#"+target.id+" #titleOff").stop().animate({opacity:0},1);
	//$("#"+target.id+" #readmoreOff").stop().animate({opacity:0},1);
	$("#"+target.id+" #titleOn").css({opacity:1});
	$("#"+target.id+" #readmoreOn").css({opacity:1});
	$("#"+target.id+" #titleOff").css({opacity:0});
	$("#"+target.id+" #readmoreOff").css({opacity:0});
	$("#"+target.id+" #imgOn").stop().animate({opacity:1},speed);
}
function newsRBoxRollout(target){
	var speed = 150;
	//$("#"+target.id+" #titleOn").stop().animate({opacity:0},1);
	//$("#"+target.id+" #readmoreOn").stop().animate({opacity:0},1);
	//$("#"+target.id+" #titleOff").stop().animate({opacity:1},1);
	//$("#"+target.id+" #readmoreOff").stop().animate({opacity:1},1);
	$("#"+target.id+" #titleOn").css({opacity:0});
	$("#"+target.id+" #readmoreOn").css({opacity:0});
	$("#"+target.id+" #titleOff").css({opacity:1});
	$("#"+target.id+" #readmoreOff").css({opacity:1});
	$("#"+target.id+" #imgOn").stop().animate({opacity:0},speed);
}
function onloadNewsRBox(target, color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0,display:"block"}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function onloadNewsBoxImgOff(target){
	$(target).animate({opacity:1},550);
}
function tintPNG(target,color){
	var rgb = hexaToRGBpixastic(color);	
	$(target).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function newsRBoxClick(slag){
	//alert(slag);
}
function newsboxRollover(target){
	var speed = 150;
	//$("#"+target.id+" #title").stop().animate({opacity:1},speed);
	//$("#"+target.id+" #text").stop().animate({opacity:1},speed);
	//$("#"+target.id+" #date").stop().animate({opacity:1},speed);
	//$("#"+target.id+" #readmore").stop().animate({opacity:1},speed);
	$("#"+target.id+" #title").css({opacity:1});
	$("#"+target.id+" #text").css({opacity:1});
	$("#"+target.id+" #date").css({opacity:1});
	$("#"+target.id+" #readmore").css({opacity:1});
	$("#"+target.id+" #imgOn").stop().animate({opacity:1},speed);
	$("#"+target.id+" #share").stop().animate({opacity:1},speed);
}
function newsboxRollout(target){
	var speed = 150;
	//$("#"+target.id+" #title").stop().animate({opacity:0},speed);
	//$("#"+target.id+" #text").stop().animate({opacity:0},speed);
	//$("#"+target.id+" #date").stop().animate({opacity:0},speed);
	//$("#"+target.id+" #readmore").stop().animate({opacity:0},speed);
	$("#"+target.id+" #title").css({opacity:0});
	$("#"+target.id+" #text").css({opacity:0});
	$("#"+target.id+" #date").css({opacity:0});
	$("#"+target.id+" #readmore").css({opacity:0});
	$("#"+target.id+" #imgOn").stop().animate({opacity:0},speed);
	$("#"+target.id+" #share").stop().animate({opacity:0},speed);
}
function onloadStudiosBox(target, color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0,display:"block"}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function studiosBoxRollover(target){
	var speed = 150;
	//$("#"+target.id+" #textOff").stop().animate({opacity:0},1);
	//$("#"+target.id+" #textOn").stop().animate({opacity:1},1);
	$("#"+target.id+" #textOff").css({opacity:0});
	$("#"+target.id+" #textOn").css({opacity:1});
	$("#"+target.id+" #img").stop().animate({opacity:1},speed);
}
function studiosBoxRollout(target){
	var speed = 150;
	//$("#"+target.id+" #textOff").stop().animate({opacity:1},1);
	//$("#"+target.id+" #textOn").stop().animate({opacity:0},1);
	$("#"+target.id+" #textOff").css({opacity:1});
	$("#"+target.id+" #textOn").css({opacity:0});
	$("#"+target.id+" #img").stop().animate({opacity:0},speed);
}
function onloadRepsBox(target, color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0,display:"block"}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function repsBoxRollover(target){
	var speed = 150;
	//$("#"+target.id+" #textOff").stop().animate({opacity:0},1);
	//$("#"+target.id+" #textOn").stop().animate({opacity:1},1);
	$("#"+target.id+" #textOff").css({opacity:0});
	$("#"+target.id+" #textOn").css({opacity:1});
	$("#"+target.id+" #img").stop().animate({opacity:1},speed);
}
function repsBoxRollout(target){
	var speed = 150;
	//$("#"+target.id+" #textOff").stop().animate({opacity:1},1);
	//$("#"+target.id+" #textOn").stop().animate({opacity:0},1);
	$("#"+target.id+" #textOff").css({opacity:1});
	$("#"+target.id+" #textOn").css({opacity:0});
	$("#"+target.id+" #img").stop().animate({opacity:0},speed);
}
function onloadPeopleBox(target, color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0,display:"block"}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function peopleBoxRollover(target){
	var speed = 150;
	$("#"+target.id+" #img").stop().animate({opacity:1},speed);
}
function peopleBoxRollout(target){
	var speed = 150;
	$("#"+target.id+" #img").stop().animate({opacity:0},speed);
}

function jobsBoxRollover(target,color, color2){
	var speed = 150;
	$(target).stop(true).animate({backgroundColor:color},speed);
	$(target).children("#boxHolder").children("#text").children("#position_txt").css({color:color2});
}
function jobsBoxRollout(target, color, color2){
	var speed = 150;
	$(target).stop(true).animate({backgroundColor:color},speed);
	$(target).children("#boxHolder").children("#text").children("#position_txt").css({color:color2});
}
function onloadFavBox(target, color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0,display:"block"}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function favBoxRollover(target){
	var speed = 150;
	$("#"+target.id+" #closeIcon").stop().animate({opacity:1},speed);
	//$("#"+target.id+" #text").stop().animate({opacity:1},speed);
	$("#"+target.id+" #text").css({opacity:1});
	$("#"+target.id+" #imgOnFav").stop().animate({opacity:1},speed);
}
function favBoxRollout(target){
	var speed = 150;
	$("#"+target.id+" #closeIcon").stop().animate({opacity:0},speed);
	//$("#"+target.id+" #text").stop().animate({opacity:0},speed);
	$("#"+target.id+" #text").css({opacity:0},speed);
	$("#"+target.id+" #imgOnFav").stop().animate({opacity:0},speed);
}
function shareIkOnRollOver(target){
	$(target).css({opacity:1});
	$(target).parent().children("#shareIk").stop();
	$(target).parent().children("#shareIk").css({opacity:0,display:"none"});
	//alert($(target).parent().children("#shareIk").css("opacity"));
}
function shareIkOnRollOut(target){
	$(target).css({opacity:0});
	$(target).parent().children("#shareIk").stop();
	$(target).parent().children("#shareIk").css({opacity:1,display:"block"});
}
function blipIcon(target){
	$(target).css({opacity:0});
	$(target).stop().delay(200).animate({opacity:1},100);
}

function projectBox2Rollover(target, color1){
	var speed = 150;
	$("#"+target.id).stop().animate({height:135,"backgroundColor":color1},speed);
	$("#"+target.id+" #imgOn").stop().animate({opacity:1},speed);
	$("#"+target.id+" #favIk").stop().animate({opacity:1},speed);
 	$("#"+target.id+" #shareIk").stop().animate({opacity:1},speed);
	$("#"+target.id+" #textOff").css({display:"none"});
	$("#"+target.id+" #textOn").css({display:"block"});
	if(projectListMode == 2){
		$("#container1 #footer").stop().animate({top:(projectListH+50)},speed);
	}
}
function projectBox2Rollout(target, color1){
	var speed = 150;
	$("#"+target.id).stop().animate({height:85,"backgroundColor":color1},speed);
	$("#"+target.id+" #imgOn").stop().animate({opacity:0},speed);
	$("#"+target.id+" #favIk").stop().animate({opacity:0},speed);
	$("#"+target.id+" #shareIk").stop().animate({opacity:0},speed);
	$("#"+target.id+" #textOff").css({display:"block"});
	$("#"+target.id+" #textOn").css({display:"none"});
	if(projectListMode == 2){
		$("#container1 #footer").stop().animate({top:projectListH},speed);
	}
}
function onloadProjectBox2(target,color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0,display:"block"}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function favIkOnRollOver(target){
	$(target).children("#circleOn").css({opacity:0});
	$(target).children("#starOn").css({opacity:0});
	$(target).children("#remove").css({display:"block",opacity:1});
	$(target).parent().children("#favIk").children("#circle").css({visibility:"hidden"});
	$(target).parent().children("#favIk").children("#star").css({visibility:"hidden"});
	if($(target).css("opacity") == 0){
		$(target).parent().children("#favIk").children("#circle2").css({visibility:"visible"});
		$(target).parent().children("#favIk").children("#star2").css({visibility:"visible"});
	}else{
		$(target).parent().children("#favIk").children("#circle2").css({visibility:"hidden"});
		$(target).parent().children("#favIk").children("#star2").css({visibility:"hidden"});
	}
}
function favIkOnRollOut(target){
	$(target).children("#circleOn").css({opacity:1});
	$(target).children("#starOn").css({opacity:1});
	$(target).children("#remove").css({display:"none"});
	$(target).parent().children("#favIk").children("#circle2").css({visibility:"hidden"});
	$(target).parent().children("#favIk").children("#star2").css({visibility:"hidden"});
	$(target).parent().children("#favIk").children("#circle").css({visibility:"visible"});
	$(target).parent().children("#favIk").children("#star").css({visibility:"visible"});
}
function onloadVideoBox(target, color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0,display:"block"}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function videoBoxRollover(target, color, color2){
	var speed = 150;
	var index = target.id.split("videobox").join("");
	index = index.split("videoname").join("");
	//var PPselectedVideo from project_page.js
	if(PPselectedVideo != index){
		//$("#videobox"+index+" #text").stop().animate({opacity:1},speed);
		$("#videobox"+index+" #imgOnVideo").stop().animate({opacity:1},speed);
		$("#videoname"+index).css({color:color2});
	}
}
function videoBoxRollout(target, color, color2){
	var speed = 150;
	var index = target.id.split("videobox").join("");
	index = index.split("videoname").join("");
	if(PPselectedVideo != index){
		//$("#videobox"+index+" #text").stop().animate({opacity:0},speed);
		$("#videobox"+index+" #imgOnVideo").stop().animate({opacity:0},speed);
		$("#videoname"+index).css({color:color2});
	}
}
function onloadImageBox(target,color){
	var rgb = hexaToRGBpixastic(color);	
	//var w = $(target).parent().css("width");
	//var h = $(target).parent().css("height");
	$(target).css({opacity:0,display:"block"}).pixastic("desaturate").pixastic("coloradjust",{red:rgb[0],green:rgb[1],blue:rgb[2]});
}
function imageBoxRollover(target){
	var speed = 150;
	$("#"+target.id+" #imgIcon").stop().animate({opacity:1},speed);
	$("#"+target.id+" #imgOnImg").stop().animate({opacity:1},speed);
}
function imageBoxRollout(target){
	var speed = 150;
	$("#"+target.id+" #imgIcon").stop().animate({opacity:0},speed);
	$("#"+target.id+" #imgOnImg").stop().animate({opacity:0},speed);
}
function connectBoxRollover(target,color){
	var speed = 150;
	//$("#"+target.id+" #textOff").stop().animate({opacity:0},1);
	//$("#"+target.id+" #textOn").stop().animate({opacity:1},1);
	$("#"+target.id+" #textOff").css({opacity:0});
	$("#"+target.id+" #textOn").css({opacity:1});
	$("#"+target.id).stop(true).animate({"backgroundColor":color},speed);
}
function connectBoxRollout(target,color){
	var speed = 150;
	//$("#"+target.id+" #textOff").stop().animate({opacity:1},1);
	//$("#"+target.id+" #textOn").stop().animate({opacity:0},1);
	$("#"+target.id+" #textOff").css({opacity:1});
	$("#"+target.id+" #textOn").css({opacity:0});
	$("#"+target.id).stop(true).animate({"backgroundColor":color},speed);
}
