function MM_preloadImages(){ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function show_hide_info(n){
	info = document.getElementById('info_' + n);
	if(info.style.display == 'none'){
		info.style.display = 'block';
		document.getElementById('show_info_' + n).style.display = 'none';
	}
	else{
		info.style.display = 'none';
		document.getElementById('show_info_' + n).style.display = 'block';
	}
}

function show_hide_inline(theObjectID){
	theObject = document.getElementById(theObjectID);
	if(theObject.style.display == 'none'){
		theObject.style.display = 'inline';
	}
	else{
		theObject.style.display = 'none';
	} 
}

function show_hide_block(theObjectID){
	theObject = document.getElementById(theObjectID);
	if(theObject.style.display == 'none'){
		theObject.style.display = 'block';
	}
	else{
		theObject.style.display = 'none';
	}
}

var tempText;
function countChar(theItem,theCounter,theMax){
	  //alert(theItem);
	  //alert(theItem.value.length);	  
	  //alert('Counter value: ' + theCounter.value);
	  //alert(theMax);                      
	
	if(theItem.value.length > theMax){
		tempText = theItem.value.substr(0,theMax);
		theItem.value = tempText;
	}
	theCounter.value = (theMax - theItem.value.length) + ' characters left.';		
}

function open_gallery(product){
	gallerywindow = window.open('galleries/' + product + '/' + product + '_gallery_main.html','gallerywindow','width=540,height=410,statusbar=no,menu=no,resizable=yes,scrollbars=no');
	gallerywindow.focus();
}

function open_glazing(section){
	glazingwindow = window.open(section + '_glazing.html','glazingwindow','width=550,height=420,statusbar=no,menu=no,resizable=yes,scrollbars=yes');
	glazingwindow.focus();
}

function open_appearance(appearance){
	appearancewindow = window.open(appearance,'appearancewindow','width=540,height=420,statusbar=no,menu=no,resizable=yes,scrollbars=yes');
	appearancewindow.focus();
}
