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");
	});*/

	
	$('.fadeHome').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
			$span.stop().fadeTo(500, 1);
		}, function () {
			$span.stop().fadeTo(500, 0);
		});
	});

	$('.fadeSuper').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
			$span.stop().fadeTo(500, 1);
		}, function () {
			$span.stop().fadeTo(500, 0);
		});
	});

	$('.fadeCash').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
		$span.stop().fadeTo(500, 1);
		}, function () {
		$span.stop().fadeTo(500, 0);
		});
	});
	

	$('.fadeLongterm').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
		$span.stop().fadeTo(500, 1);
		}, function () {
		$span.stop().fadeTo(500, 0);
		});
	});
	

	$('.fadeProperty').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
		$span.stop().fadeTo(500, 1);
		}, function () {
		$span.stop().fadeTo(500, 0);
		});
	});

	$('.fadeContact').append('<span class="hover"></span>').each(function () {
		var $span = $('> span.hover', this).css('opacity', 0);
		$(this).hover(function () {
		$span.stop().fadeTo(500, 1);
		}, function () {
		$span.stop().fadeTo(500, 0);
		});
	});
});

/*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("&");*/
	
	var strReturn = "";
	 var strQueryString = top.window.location.search;
         if (!strQueryString) {
          strQueryString = top.window.location.hash;
         }
	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');

