

// change which products show
var productclasses = [];
function productcheckchange(checkboxname, classname){

// maintain array
	if ($('#'+checkboxname).attr('checked')) {
		// remove class from array that holds hidden classes
//		alert(productclasses.toString());
		idx=-1;
		for(var i=0; i<productclasses.length; i++){
			if(productclasses[i]==classname){
				idx = i;
				break;
			}
		}
		if(idx!=-1) productclasses.splice(idx, 1);
	}
	else{
		// add class to array that holds hidden classes
		productclasses.push(classname);
	}

	// show all classes
   	$(".product").show();

	// hide all classes that are in the array
	for (x in productclasses){
//		alert(productclasses[x]);
		if(productclasses[x]==classname){$("."+productclasses[x]).fadeOut('slow');}
		else{$("."+productclasses[x]).hide();}

	}	
}

/************************************************************************/
$(function(){
	// dropdown menu
	$("ul.sf-menu").supersubs({ 
		animation     : {opacity:"0.8"}
        ,delay        : 80
        ,speed        : "normal"
        ,dropShadows  : false  // keep false (caused rendering  issues in older IE's)
        ,oldJquery    : false  // set to true if using jQuery version below 1.2
        ,disableHI    : true   // set to true to disable hoverIntent detection
        ,autoArrows   : false  // disable generation of arrow mark-up 
		,minWidth:    12,   
		maxWidth:    27,    
		extraWidth:  1 
	}).superfish();	
	
	$('button, input:submit, .abutton').button();

//	$("a[rel='pcolorbox']").colorbox({width:"50%", inline:true, href:"#inline_example1"});
	$("a[rel='pcolorbox']").colorbox({
		width:"420px",
		inline:true
	});

	$("a[rel='colorbox']").colorbox({
		transition:"fade",
//		current: "{current} of {total}"
		current: ""
	});	
	
	// background rollover styles for main menu
	$('.menucell, .menurtcell').hover(function() {
		$(this).addClass('menucellhover');
	}, function() {
		$(this).removeClass('menucellhover');
	});	
	
	// round corners
	$(".roundedcorner").corner();
});
/********************************************************/
//jquery dropdown menu
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function mainmenu_open()
{  mainmenu_canceltimer();
   mainmenu_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');
}

function mainmenu_close()
{  if(ddmenuitem) {
	ddmenuitem.css('visibility', 'hidden');
}
}

function mainmenu_timer()
{  closetimer = window.setTimeout(mainmenu_close, timeout);}

function mainmenu_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}




//***********************************************************************************
function submitsearch(){ 
	document.searchform.submit();}
//***********************************************************************************
function loadpage(thepagename){
}
//***********************************************************************************
function getElementHeight(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.height;
	} else {
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		if (op5) { 
			xPos = elem.style.pixelHeight;
		} else {
			xPos = elem.offsetHeight;
		}
		return xPos;
	} 
}
//*****************************************************************************************
String.prototype.trim = function() {
	return this.ltrim().rtrim();
};

String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}

String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}
//***********************************************************************************

