var temp_exp='';
var temp_lnk='';
var temp_arr='';

$(document).ready(function(){
	$("a").each(function(i){
		++i;
		$(this).focus(function(){
			$(this).blur(); //IE6 hack to remove link outline
		});
	});

	$("a").each(function(i){
		++i;
		$("#expand"+i).mouseover(function(){
			$("#arrow"+i).attr("src","images/arr_wdown.gif");
		});
	});

	$("a").each(function(i){
		++i;
		$("#expand"+i).mouseout(function(){
			$("#arrow"+i).attr("src","images/arr_bdown.gif");
		});
		
	});

	$("img#arr_download").prev().hover(function(){
		//alert(document.getElementById("arr_download").src);
		document.getElementById("arr_download").src=document.getElementById("arr_download").src.replace("_off","_on");
	},function(){
		document.getElementById("arr_download").src=document.getElementById("arr_download").src.replace("_on","_off");
	});


	$("a").each(function(i){
		++i;
		$("#expand"+i).click(function(event){
			if(temp_exp != ''){
				temp_exp.slideUp('slow');
				temp_exp.parent().css("background-color","");
				temp_lnk.text("Expand for more");
				temp_arr.attr("src","images/arr_bdown.gif");
				temp_exp.parent().parent().css("background-color","");
			}

			if(document.getElementById("hide_block"+i).style.display!="none"){
				$("#hide_block"+i).slideUp('slow');

				if(i==4 || i==5 || i==6)
					$("#hide_block"+i).parent().parent().css({
					"background-color":"",
					"position":"static",
					"left":"auto",
					"padding-left":"0px"});
				else
					$("#hide_block"+i).parent().css({
					"background-color":"",
					"position":"static",
					"left":"auto",
					"padding-left":"0px"});

				$(this).text("Expand for more");
				$("#arrow"+i).attr("src","images/arr_bdown.gif");
				$(this).mouseover(function(){
					$("#arrow"+i).attr("src","images/arr_wdown.gif");
				});
				$(this).mouseout(function(){
					$("#arrow"+i).attr("src","images/arr_bdown.gif");
				});
			}
			else{
				$("#hide_block"+i).slideDown('slow');
				
				if(i==4 || i==5 || i==6)
					$("#hide_block"+i).parent().parent().css({
					"background-color":"#242424",
					"left":"-10px",
					"position":"relative",
					"padding-left":"10px"});
				else
					$("#hide_block"+i).parent().css({
					"background-color":"#242424",
					"position":"relative",
					"left":"-10px",
					"padding-left":"10px"});
				
				$("#hide_block9").parent().css("background-color","");

				$("#expand"+i).text("Contract for less");
				$("#arrow"+i).attr("src","images/arr_bup.gif");
				$(this).mouseover(function(){
					$("#arrow"+i).attr("src","images/arr_wup.gif");
				});
				$(this).mouseout(function(){
					$("#arrow"+i).attr("src","images/arr_bup.gif");
				});
			}
			temp_exp = $("#hide_block"+i);
			temp_lnk = $("#expand"+i);
			temp_arr = $("#arrow"+i);
		});
	});

	$("a").each(function(i){
		++i;
		$("#show"+i).mouseover(function(){
			$("#show_arrow"+i).attr("src","images/arrow_white.gif");
		});
	});

	$("a").each(function(i){
		++i;
		$("#show"+i).mouseout(function(){
			$("#show_arrow"+i).attr("src","images/arr_blue.gif");
		});
	});

	$(".share_link").click(function(){
		$("#social_share").show(200);
		$("#social_share").position().left = $(this).position().left+"20px";
		$("#social_share").position().top = $(this).position().top+"50px";
	});
	$("#hide_tool").click(function(){
		$("#social_share").hide('slow');
	});

	/*$("img.img-hover").hover(
	function(){
		this.src=this.src.replace("_off","_on");
	},
	function(){
		this.src=this.src.replace("_on","_off");
	});*/

	/*$("img.img-hover").hover(function(){
		this.src=this.src.replace("_off","_on");
	},function(){
		this.src=this.src.replace("_on","_off");
	});*/
});

/*Video Script*/

$(document).ready(function(){
	$(".playbutton").mouseover(function(){
		$(".playbutton").attr("src","images/hm_play_on.gif");
	});
	$(".playbutton").mouseout(function() {
		$(".playbutton").attr("src","images/hm_play_off.gif");
	});
});
function getParameter(strParamName){
	var strReturn = "";
	var strQueryString = top.window.location.search;
	var aQueryString = strQueryString.split("&");
	for(var iParam = 0; iParam< aQueryString.length; iParam++ ){
		if( aQueryString[iParam].indexOf(strParamName + "=")>-1 ){
			var aParam = aQueryString[iParam].split("=");
			strReturn = aParam[1];
			break;
		}
	}
	return strReturn;
}
var file=getParameter('f');
var vidfile=getParameter('v');


/*$(document).ready(function() {
	$('.abc').selectbox();
});*/

$(document).ready(function(){
	$(".menu-list").hover(function(event){
		$(this).find(".menuoff").fadeTo('slow',0.1);

		if($(this).find(".drop-menu").length != 0)
			$(".drop-menu").show('slow', function(){
				$(this).fadeTo('slow', 0.9);
			});
	},
	function(){
		$(this).find(".menuoff").fadeTo('slow',1.0);

		if($(this).find(".drop-menu").length != 0)
			$(".drop-menu").hide(50);
	});
});

$(document).ready(function(){
	$(".menu-list-projects").hover(function(event){
		$(this).find(".menuoff").fadeTo('slow',0.1);

		if($(this).find(".drop-menu-projects").length != 0)
			$(".drop-menu-projects").show('slow', function(){
				$(this).fadeTo('slow', 0.9);
			});
	},
	function(){
		$(this).find(".menuoff").fadeTo('slow',1.0);

		if($(this).find(".drop-menu-projects").length != 0)
			$(".drop-menu-projects").hide(50);
	});
});

$(document).ready(function(){
	$(".menu-list-investors").hover(function(event){
		$(this).find(".menuoff").fadeTo('slow',0.1);

		if($(this).find(".drop-menu-investors").length != 0)
			$(".drop-menu-investors").show('slow', function(){
				$(this).fadeTo('slow', 0.9);
			});
	},
	function(){
		$(this).find(".menuoff").fadeTo('slow',1.0);

		if($(this).find(".drop-menu-investors").length != 0)
			$(".drop-menu-investors").hide(50);
	});
});

$(document).ready(function(){
	$(".menu-list-guide").hover(function(event){
		$(this).find(".menuoff").fadeTo('slow',0.1);

		if($(this).find(".drop-menu-guide").length != 0)
			$(".drop-menu-guide").show('slow', function(){
				$(this).fadeTo('slow', 0.9);
			});
	},
	function(){
		$(this).find(".menuoff").fadeTo('slow',1.0);

		if($(this).find(".drop-menu-guide").length != 0)
			$(".drop-menu-guide").hide(50);
	});
});

$(document).ready(function(){
	$(".menu-list-news").hover(function(event){
		$(this).find(".menuoff").fadeTo('slow',0.1);

		if($(this).find(".drop-menu-news").length != 0)
			$(".drop-menu-news").show('slow', function(){
				$(this).fadeTo('slow', 0.9);
			});
	},
	function(){
		$(this).find(".menuoff").fadeTo('slow',1.0);

		if($(this).find(".drop-menu-news").length != 0)
			$(".drop-menu-news").hide(50);
	});
});

/*Menu tab*/
function showDiv(divid,alink,xpos,ypos){
	var obj = document.getElementById(divid);
	var cord = getAnchorPosition(alink);
	cord.y = (cord.y*1+ypos*1);
	cord.x = (cord.x*1+xpos*1);
	obj.style.top = eval("'"+cord.y + "px'"); 
	obj.style.left = eval("'"+cord.x + "px'");
	obj.style.display = "block";
	obj.style.zindex = "100";
}

function hideDiv(divid){
	var obj = document.getElementById(divid);
	obj.style.display = "none";
}

function slideSwitch() {
	var $active = $('#slideshow IMG.active');

	if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

	var $next =  $active.next().length ? $active.next()
		: $('#slideshow IMG:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 1000, function() {
			$active.removeClass('active last-active');
		});
}

$(function() {
	setInterval( "slideSwitch()", 5000 );
});
