// JavaScript Document
$(document).ready(function () {
	//navigation subitems

    $("#subNav li").mouseover(function(){
		$(this).css("background","#606061");
		
		 $("#subNav li").each(function() {
			$(this).find('ul').css("display","none");
		 });
		 $(this).find("ul").css("display","block");
    }).mouseout(function() {
		if ($(this).attr("class") != 'selected') $(this).css("background","none");
		$(this).find("ul").css("display","none");
		/*
		$(this).find("ul").find('li').each(function(){
			$(this).css('display', 'none');
		});
		*/
	});

/*
	$("#subNav li ul").mouseout(function(){

		$(this).css("display","none");
	
	});
*/
	/*	
	.mouseout(function(){
		if ($(this).attr("class") != 'selected') $(this).css("background","none");
		$(this).find("ul").css("display","none");
		$(this).find("ul").find('li').each(function(){
			this.css('display', 'none');
		});
		
    });
	*/




    $(".register.newsletter").click(function(){
		if ($('#register').css('display') == 'none') {
			$('#register').css('display','block');
			return false;
		} else {
			$('#register').css('display','none');
			return false;
		}
    });



    $(".sendFriend").click(function(){
		if ($('#sendToFriend').css('display') == 'none') {
			$('#sendToFriend').css('display','block');
			return false;
		} else {
			$('#sendToFriend').css('display','none');
			return false;
		}
    });




    $(".center.productDetails .sendInquiry").click(function(){
		if ($('#inquiry').css('display') == 'none') {
			$('#inquiry').css('display','block');
			return false;
		} else {
			$('#inquiry').css('display','none');
			return false;
		}
    });




    $(".searchFilter .itemContainer a.itemContainerTitle").click(function(){
//	alert($(this).find('ul'));
//$("#theRow").find("td > div.total");													 

		if ($(this).parent().find('ul.searchFilterSubitems')) {

			if ($(this).parent().find('ul').css('display') == 'none') {
				$(this).parent().find('ul').css('display','block');
				
				$(this).parent().addClass('selected');
	
	
				return false;
			} else {
				$(this).parent().find('ul').css('display','none');
				$(this).parent().removeClass('selected');
				return false;
			}
		}
    });






});



function selectCheckboxes(container,type,el) {
	if (type) {
		$('#'+container+' input:checkbox').attr("checked","checked");
		$('#'+el).attr("checked","checked");
	} else {
		$('#'+container+' input:checkbox').removeAttr("checked");
		$('#'+el).removeAttr("checked");
	}
}



// custom functions
function popUpPrint(URL) {
	window.open( URL, "myWindow", "status = 1, height = 600, width = 960, toolbar=no, scrollbars=yes, menubar=no, resizable = yes" )	
}

function popUpPrint(URL, width, height) {
	if(!width || width=='') width = 700;
	if(!height || height =='') height = 600;
	window.open( URL, "myWindow", "status = 1, height = " + height + ", width = " + width + ", toolbar=no, scrollbars=yes, menubar=no, resizable = yes" )	
}
