$(document).ready(function() {

	// Shows the block_order_info, when it has been disabled. (See block_order_info.html)
	$("#show_block_order_info").bind("click",function(){
		$("#block_order_info").show();
	});

	//-- 
	$(".baskethover").hover(function() {
		 $("#mybasket").fadeIn("fast");
		 //$("#mybasket").slideDown("slow");
	},function(){
		 $("#mybasket").css("display", "none" );
	});

	$('#xbl_catlist .head').bind("click", function() {
		thisID =  parseInt( $(this).attr('name') );

		if($("#lhsub"+thisID).hasClass("dispnone")){
			$(".lhsubul").addClass("dispnone");
			$("#lhsub"+thisID).removeClass("dispnone");
		} else {
			//$("#lhsub"+thisID).hide("fast");
			$("#lhsub"+thisID).addClass("dispnone");
		}
		
	});

	//-- handle the character items navigation
	var arrCharTypes = new Array();
	arrCharTypes[1] = "Mercenary / Warrior";
	arrCharTypes[2] = "Duellist / Villain";
	arrCharTypes[3] = "Wizard / Sorcerer";
	arrCharTypes[4] = "Priest / Clergyman";
	arrCharTypes[5] = "Scout / Rogue";
	arrCharTypes[6] = "Priest / Clergyman";

	var arrCharPath = new Array();
	arrCharPath[1] = "products.php?category_id=19";
	arrCharPath[2] = "products.php?category_id=20";
	arrCharPath[3] = "products.php?category_id=37";
	arrCharPath[4] = "products.php?category_id=38";
	arrCharPath[5] = "products.php?category_id=19";
	arrCharPath[6] = "products.php?category_id=20";

	function setCharImage(thisID){
		$('.chartypethumb').css("border", "1px solid #666;" );
		$( "#chartypeid"+thisID ).css("border", "1px solid #D30000;" );
		$("#mainpic").src = ('images/primalforge/chartypes/chthumb_'+thisID+'.jpg');
		$('#maincharimage').css("background-image", 'url(images/primalforge/chartypes/char'+thisID+'.jpg)' );
		$('.charlink').attr('title',arrCharTypes[thisID]);
		$('#chartypetext').text( arrCharTypes[thisID] );
		$('.charlink').attr('href',arrCharPath[thisID]);		
	}

	setCharImage( Math.floor(Math.random()*4 ) + 1 );

	$('.chartypethumb').click(function() {
		setCharImage( $(this).attr("tindex") );
	});

});
