<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_closeBrWindow(theURL,winName) 
		{window.close(theURL,winName);
}

menu_status = new Array();
function showHide(theid){
if (document.getElementById) {
var switch_id = document.getElementById(theid);

if(menu_status[theid] != 'show') {
switch_id.className = 'show';
menu_status[theid] = 'show';
}else{
switch_id.className = 'hide';
menu_status[theid] = 'hide';
}
}
}

function refreshPage(formValue){
	window.location.href = formValue;
return true;
}

//----------------------------
//Show hide on forms

function changeme() {
x = document.getElementById("formselectIdname").selectedIndex;
if (x == 0) {
document.getElementById("changeMenow").style.display = "none";
//window.document.getElementById("option2div").style.display = none;
}
else {
document.getElementById("changeMenow").style.display = "block";
//window.document.getElementById("option2div").style.display = block;
}
}

// '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
// Preload Object


image1 = new Image();
image1.src = "images/home_over.jpg";
image2 = new Image();
image2.src = "images/products_over.jpg";
image3 = new Image();
image3.src = "images/applications_over.jpg";
image4 = new Image();
image4.src = "images/advantages_over.jpg";
image5 = new Image();
image5.src = "images/resources_over.jpg";
image6 = new Image();
image6.src = "images/about_over.jpg";
image7 = new Image();
image7.src = "images/quote_over.jpg";
image8 = new Image();
image8.src = "images/logo_bulktec_large-over.png";
image9 = new Image();
image9.src = "images/logo_hydrotec_large-over.png";
image10 = new Image();
image10.src = "images/logo_petrotec_large-over.png";


// '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
// Random Photo

imgswap = new Array('images/sub_photo01.jpg','images/sub_photo02.jpg','images/sub_photo03.jpg','images/sub_photo04.jpg','images/sub_photo05.jpg','images/sub_photo06.jpg','images/sub_photo07.jpg','images/sub_photo08.jpg','images/sub_photo09.jpg'); 

rnd.today=new Date(); 
rnd.seed=rnd.today.getTime(); 

function rnd(){ 
	rnd.seed = (rnd.seed*9301+49297) % 233280; 
	return rnd.seed/(233280.0); 
}; 

function rand(number){ 
	return Math.ceil(rnd()*number); 
}; 

// div layer popup
function layerSetup(id,visibility){
	if(document.getElementById)
	{
		this.obj = document.getElementById(id).style;
		this.obj.visibility = visibility;
		return this.obj;
	}
	else if(document.all)
	{
		this.obj = document.all[id].style;
		this.obj.visibility = visibility;
		return this.obj;
	}
	else if(document.layers)
	{
		this.obj = document.layers[id];
		this.obj.visibility = visibility;
		return this.obj;
	}
}

function visVisible(param){
	new layerSetup(param,'visible');
}
function visHidden(param){
	new layerSetup(param,'hidden');
}

// change the plus image
function Touch(myGraphic){
	x = document.getElementById(myGraphic).src;
	x = x.split('/');
	i = x.length-1;
	y = x[i];

	if (y == 'plus.gif'){
		document.getElementById(myGraphic).src = 'images/minus.gif';
	} else {
		document.getElementById(myGraphic).src = 'images/plus.gif';
	}
}

function homeProducts(){ 
if($("#homepage_products").length) {
	var newText ='';
	var newImg = '';	
	var newLink = '';
	
	$('#homepage_products > span a').click( function() {
		newLink = $(this).attr("href");
		
		switch( $(this).parent().attr("class") ) {
			case 'bulktec':
				newText = 'BulkTec &trade; tanks are manufactured in field-constructed bolted or shop-welded design configurations and have been successfully installed in thousands of different applications handling all kinds of dry bulk materials.  Each tank system is custom engineered for your specific use by our in-house professional engineers to meet your unique performance needs.';
				newImage = 'bulkTec_details.gif';
				break;
			case 'hydrotec':
				newText = 'HydroTec &trade; modular bolted tanks are designed to meet the exacting standards of your unique applications.  Our next generation OptiBond<sup style="font-variant:small-caps;line-height:1px;">tm</sup> coating process featuring Trico-Bond EP<sup style="font-variant:small-caps;line-height:1px;">tm</sup> epoxy yields the best corrosion resistance and delivers long service life.  HydroTec tanks are constructed 3 times faster than other technologies saving you valuable time and money.';
				newImage = 'bulkTec_details.gif';
				break;
			case 'petrotec':
				newText = 'PetroTec &trade; modular bolted tanks are designed to meet the exacting standards of your unique petroleum related applications.  PetroTec<sup style="font-variant:small-caps;line-height:1px;">tm</sup> is the only certified API-12B tank design manufactured in the United States.  The CTT PetroTec<sup style="font-variant:small-caps;line-height:1px;">tm</sup> tank is the #1 requested bolted tank design requested by petroleum professionals in the world.';
				newImage = 'bulkTec_details.gif';
				break;
			default:
				//console.log('unknow case in function "homeProducts()"');
			break;
		}	
		
		if( $(this).hasClass("selected") ) {
			$("#homepage_productDetail").slideUp(1000);
			$('#homepage_products > span a').removeClass('selected');
		} else {
			$('#homepage_products > span a').removeClass('selected');
			$(this).addClass('selected');
			 
			//show container if not there
			if( $("#homepage_productDetail").not(":visible") ) {
				setTimeout( function(){ $("#homepage_productDetail").slideDown(800); }, 200);
			}

			//switch content		
			//$("#homepage_productDetail .content p").slideUp(400, function(){
			$("#homepage_productDetail .content").slideUp(400, function(){
				var productBox = $(this);
				setTimeout( function(){
					productBox
						.find('img').attr("src", "images/"+newImage).end()
						.find('span').html(newText).end();
					
					if(productBox.find('a.btn_learnMore').length){ 
						productBox.find('a.btn_learnMore').attr('href', newLink).end();
					} else { 
						console.log("more button not found");
					}
						
					
					productBox.slideDown(400);
				}, 500);
			});
		}
		return false;
	});
}}

//DOM Loaded
$(document).ready(function () 
{
	//calculator actions
	if( typeof tankTypeChange == 'function' )
		tankTypeChange();
	if( typeof measurementUnitChange == 'function' )
		measurementUnitChange();
	if( typeof homeProducts == 'function' )
		homeProducts();
	
	//for submitting to the 'quick quote form'
	if($(".calculator_submit").length)
	{
		$(".calculator_submit").click(function()
		{
			//$(form) is assumed if there is a calculator_submit button
			$('form').submit();
		});
				
		$(".calculator_submit").mouseover(function()
		{
			//$(form) is assumed if there is a calculator_submit button
			$(this).addClass("hover");
		}).mouseout(function(){
			$(this).removeClass("hover");
		});
	}
	
	
});

