var navBG = new Image();
navBG.src = "../img/img_nav_bg_on.gif";
oTimer = null;
strCurrentMenu = "";


//Pressroom Image Variables
var imgWarehouseLandingOn = new Image();
var imgWarehouseLandingOff = new Image();
var imgMfgLandingOn = new Image();
var imgMfgLandingOff = new Image();
var imgShowroomLandingOn = new Image();
var imgShowroomLandingOff = new Image();
var imgLogosLandingOn = new Image();
var imgLogosLandingOff = new Image();
var imgProductsLandingOn = new Image();
var imgProductsLandingOff = new Image();
var imgEventsLandingOn = new Image();
var imgEventsLandingOff = new Image();
var imgFacilitiesLandingOn = new Image();
var imgFacilitiesLandingOff = new Image();
var imgPeopleLandingOn = new Image();
var imgPeopleLandingOff = new Image();

var imgContractorsOff = new Image();
var imgContractorsOn = new Image();
var imgTechnicalOn = new Image();
var imgTechnicalOff = new Image();
var imgServiceOn = new Image();
var imgServiceOff = new Image();
var imgWindowsOff = new Image();
var imgWindowsOn = new Image();

var imgProductWindowOn = new Image();
var imgProductWindowOff = new Image();
var imgProductDoorOn = new Image();
var imgProductDoorOff = new Image();

var imgEnclosureOn = new Image();
var imgEnclosureOff = new Image();

var imgPatioOn=new Image();
var imgPatioOff= new Image();

//social media declaration
var imgFacebookOn = new Image();
var imgFacebookOff = new Image();
var imgTwitterOn = new Image();
var imgTwitterOff = new Image();
var imgYoutubeOn = new Image();
var imgYoutubeOff = new Image();



imgEnclosureOff.src="/img/Products/enclosure_off.gif";
imgEnclosureOn.src="/img/Products/enclosure_on.gif";

imgPatioOn="/img/Products/patio_rooms.gif";
imgPatioOff="/img/Products/patio_rooms_off.gif";

imgContractorsOff.src ="/img/btn_pro_contractors_on.gif";
imgContractorsOff.src ="/img/btn_pro_contractors.gif";
imgTechnicalOff.src ="/img/nav/nav_pro_technical.gif";
imgTechnicalOn.src ="/img/nav/nav_pro_techincal_on.gif";
imgServiceOff.src ="/img/nav/nav_pro_service.gif";
imgServiceOn.src ="/img/nav/nav_pro_service_on.gif";

//Pressroom Images
imgWarehouseLandingOn.src = "/img/gallery/buttons/img_warehouse_landingOn.gif";
imgWarehouseLandingOff.src = "/img/gallery/buttons/img_warehouse_landing.gif";
imgMfgLandingOn.src = "/img/gallery/buttons/img_mfg_landingOn.gif";
imgMfgLandingOff.src = "/img/gallery/buttons/img_mfg_landing.gif";
imgShowroomLandingOn.src = "/img/gallery/buttons/img_showroom_landingOn.gif";
imgShowroomLandingOff.src = "/img/gallery/buttons/img_showroom_landing.gif";
imgLogosLandingOn.src = "/img/gallery/buttons/img_logos_landingOn.gif";
imgLogosLandingOff.src = "/img/gallery/buttons/img_logos_landing.gif";
imgProductsLandingOn.src = "/img/gallery/buttons/img_products_landingOn.gif";
imgProductsLandingOff.src = "/img/gallery/buttons/img_products_landing.gif";
imgEventsLandingOn.src = "/img/gallery/buttons/img_events_landingOn.gif";
imgEventsLandingOff.src = "/img/gallery/buttons/img_events_landing.gif";
imgFacilitiesLandingOn.src = "/img/gallery/buttons/img_facilities_landingOn.gif";
imgFacilitiesLandingOff.src = "/img/gallery/buttons/img_facilities_landing.gif";
imgPeopleLandingOn.src = "/img/gallery/buttons/img_people_landingOn.gif";
imgPeopleLandingOff.src = "/img/gallery/buttons/img_people_landing.gif";

//social media Images
imgFacebookOn.src = "/img/gallery/buttons/img_facebook_on.gif";
imgFacebookOff.src = "/img/gallery/buttons/img_facebook_off.gif";
imgTwitterOn.src = "/img/gallery/buttons/img_twitter_on.gif";
imgTwitterOff.src = "/img/gallery/buttons/img_twitter_off.gif";
imgYoutubeOn.src = "/img/gallery/buttons/img_youtube_on.gif";
imgYoutubeOff.src = "/img/gallery/buttons/img_youtube_off.gif";


//Image Gallery Code for Pressroom
$(document).ready(function(){
		    
$(".buttons").click(function () {
	var divname= this.value;
	$("#"+divname).show("slow").siblings().hide("slow");
	});
});

// Corner Code
$(document).ready(function(){
  $('#chooseContractor').corner('8px');
  $('#footer').corner('8px tr tl');
  $('#aboveFooter').corner('18px tr tl');
  $('#leftNavContainer').corner('8px br');
  $('.leftNavContainer').corner('8px br');
  $('.notification').corner('round 12px');
  $('.press').corner('12px'); 
  $('.highlight').corner('8px'); 
  $('.roundStd').corner('round 12px');
  $('.gridExtra').corner('round 12px');
  $('#back-top').corner('round 15px');
  $('#harveySEOpages').corner('round 12px');
  $('#harveySEOpageshome').corner('round 12px');
});

//Toggle
$(document).ready(function(){

	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("h3.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});

});
//END Toggle

$(document).ready(function(){
// main and top nav hover functions
  $('.mainNav img, #quickLinks img').hover( 
    function(){
      if (!$(this).hasClass('selected'))
        $(this).attr('src',$(this).attr('src').replace(".gif","_on.gif"));
    },function(){
      if (!$(this).hasClass('selected'))
        $(this).attr('src',$(this).attr('src').replace("_on.gif",".gif"));
    }
  );
  $('.navItem img').hover(
    function(){
      if ($(this).hasClass('pngImage'))
        $(this).attr('src',$(this).attr('src').replace(".png","_on.png"));
      else
        $(this).attr('src',$(this).attr('src').replace(".gif","_on.gif"));
    },function(){
      if ($(this).hasClass('pngImage'))
        $(this).attr('src',$(this).attr('src').replace("_on.png",".png"));
      else
        $(this).attr('src',$(this).attr('src').replace("_on.gif",".gif"));
    }
  );
	

});

// 
$(document).ready(function(){
  $('.windowLandingCopy a img').hover(function(){
      imgSrc = $(this).attr('src');
      imgOnSrc = imgSrc.replace('_off','_on');    
      $(this).attr('src',imgOnSrc);
    },function(){
      imgOnSrc = $(this).attr('src');
      imgSrc = imgOnSrc.replace('_on','_off'); 
      $(this).attr('src',imgSrc);
    }
  );
});
$(function(){
    $('.productRow div a img').hover(function(){
        imgSrc = $(this).attr('src');
        imgOnSrc = imgSrc.replace('_off','_on');
        $(this).attr('src',imgOnSrc);
    },function(){
        imgOnSrc = $(this).attr('src');
        imgSrc = imgOnSrc.replace('_on','_off');
        $(this).attr('src',imgSrc);
    });

  $('.patioPage').hover(function(){
        imgSrc = $(this).attr('src');
        imgOnSrc = imgSrc.replace('_off','_on');
        $(this).attr('src',imgOnSrc);
    },function(){
        imgOnSrc = $(this).attr('src');
        imgSrc = imgOnSrc.replace('_on','_off');
        $(this).attr('src',imgSrc);
    });
});

// hover for social media icons
$(document).ready(function(){
  $('.social a img').hover(function(){
      imgSrc = $(this).attr('src');
      imgOnSrc = imgSrc.replace('_off','_on');    
      $(this).attr('src',imgOnSrc);
    },function(){
      imgOnSrc = $(this).attr('src');
      imgSrc = imgOnSrc.replace('_on','_off'); 
      $(this).attr('src',imgSrc);
    }
  );
});

function fShowDropdown(strID) {
//alert("strID:"+strID);
	if(strCurrentMenu != "") {
		fHideDiv(strCurrentMenu);
	}
	strCurrentMenu = strID;
	var oDiv = document.getElementById(strID);
	oDiv.style.visibility = "visible";
	oDiv.style.display = "block";
	if(oTimer != null) {
		clearTimeout(oTimer);
	}
}

function fHideDropdown(strID) {
	oTimer = setTimeout('fHideDiv(\"' + strID + '\");', 500);
}

function fHideDiv(strID) {
	var oDiv = document.getElementById(strID);
	oDiv.style.display = "none";
	oDiv.style.visibility = "hidden";
}

function fShowDiv(strID) {
	var oDiv = document.getElementById(strID);
	oDiv.style.display = "block";
	oDiv.style.visibility = "visible";
}

function photoPop(theURL, imgWidth, imgHeight) {
			window.open(theURL, "popWin", "width=" + (imgWidth + 20) + ",height=" + (imgHeight + 20));
            }
			
function glossaryPop (url) {
            window.open(url, "Glossary", "status=0, toolbar=0, scrollbars=0, width=724, height=699");
            }
            
$(document).ready(function(){
  $('#productPerformance tr').each(function(){
    $(this).children('th').css({textAlign:'center',borderRight:'solid 1px #999999',backgroundColor:'#999999',color:'#ffffff',padding:'3px 5px'})
    $(this).children('td').css({textAlign:'center',borderRight:'solid 1px #999999',padding:'3px 5px'});  
    $(this).children('th:first').css({textAlign:'left',borderRight:'solid 1px #999999'});
    $(this).children('td:first').css({textAlign:'left',borderRight:'solid 1px #999999'});  
  });
});

function fShowCommercial() {
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="300" id="harvey_vidbox" align="middle">');
    document.write('<param name="allowScriptAccess" value="sameDomain" />');
    document.write('<PARAM NAME="FlashVars" VALUE="pxvideo=Harvey.flv" />');
    document.write('<param name="movie" value="commercial/flash/harvey_vidbox.swf" /><param name="wmode" value="transparent" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="commercial/flash/harvey_vidbox.swf" quality="high"  wmode="transparent" bgcolor="#ffffff" width="400" height="300" name="harvey_vidbox" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" FlashVars="pxvideo=Harvey.flv" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('</object>');
  }
 
$(function(){
  $('.galleryLandingLink').hover(function(){
    $(this).children('.forProsButton').attr('src',$(this).children('.forProsButton').attr('src').replace('_off','_on'));
  },function(){
    $(this).children('.forProsButton').attr('src',$(this).children('.forProsButton').attr('src').replace('_on','_off'));
  });
});


//Testimonial randomizer

//totalImages = 5;
	

//imageTag1 = '<img src="/img/testimonial/quote_0';
//imageTag2 = '.jpg" height="309" width="245" alt="" border="0" /></a>';

//function writeTestimonial() {
//var r = Math.ceil(Math.random() * totalImages);

//document.write(imageTag1 + r + imageTag2);
//}

var strlang = "";
var strseason = "";
var currentTime = new Date();
var randTime = currentTime.getTime();

function fShowModal(strID) {
	var oDiv = document.getElementById(strID);
	oDiv.style.visibility = "visible";
	oDiv.style.display = "block";
}

function fHideModal(strID) {
	var oDiv = document.getElementById(strID);
	oDiv.style.visibility = "hidden";
	oDiv.style.display = "none";
}
/*

  Return the prefix appended to the beginning of a .NET web control by the 

  server.  The supplied string represents a classname that has been applied to 

  one of the web controls.  Using jquery, we can obtain the id attribute of a 

  form element with that class name, strip out the server-appended prefix and 

  return it.

  @param strFieldClassName the class attribute of one of the form fields

*/



function fGetDotNetPrefix(strFieldClassName) {

//alert("fGetDotNetPrefix(\"" + strFieldClassName + "\") called.");

  var strResponse = $("." + strFieldClassName).attr("id");

//alert("strResponse = " + strResponse);

  if(strResponse == undefined) {

		strResponse = "";

  } else {

		var intIndex = strResponse.lastIndexOf("_");

		if(intIndex == -1) {

			strResponse = "";

		} else {

			strResponse = strResponse.substr(0,intIndex + 1);

//alert("strResponse = " + strResponse);

		}

  }

  return strResponse;

}




function toggleImageBoxes(strClass,strID,boxClass)
{
   var dotnet = fGetDotNetPrefix(strClass);
   var boxID = strID.substring(3);
   strID = dotnet+strID;

     if(!$("#btn"+boxID).children().hasClass("col"))
     {

        $("."+strClass).children().removeClass("col");
         $("."+strClass).children().addClass("exp");
         $("."+strClass).children().attr("src","img/img_plus.gif");
         $("."+boxClass).hide(); 
        $("#btn"+boxID).children().removeClass("exp");
        $("#btn"+boxID).children().addClass("col");
        $("#btn"+boxID).children().attr("src","img/img_minus.gif");
        $("#box_"+boxID).show();
        return false;
     }
     else if($("#btn"+boxID).children().hasClass("col"))
     {

         $("."+strClass).children().removeClass("col");
         $("."+strClass).children().addClass("exp");
         $("."+strClass).children().attr("src","img/img_plus.gif");
         $("."+boxClass).hide(); 
         return false;
     }
}

// rrp program page Show/Hide
$(document).ready(function(){
	//$(".accordion2 h").eq(0).addClass("active");
	//$(".accordion2 p").eq(0).show();

	$(".accordion2 h3").click(function(){
		$(this).next("span").slideToggle("slow")
		.siblings("span:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});

});

