

$j = jQuery.noConflict();


$j(document).ready(function() {
  $j(".store-img .navinator a").click(function() {
    
        //alert($j(this).attr("rel"));
        $j(".store-img .navinator a").each(function(){
			$j(this).removeClass("active");
		})
		$j(this).addClass("active");
		
		
		
		/*
		var img = new Image();
		img.src = $j(this).attr("rel");
		
		if(img.width > img.height){
			var maxHeight = 290;
			if(img.height <= maxHeight){maxHeight=img.height;}

			var myWidth = (maxHeight*img.width)/img.height;
			
			$j('.mainimg img').width(myWidth);
			$j('.mainimg img').height(maxHeight);
		}else{
			var maxWidth = 200;

			var myHeight = (maxWidth*img.height)/img.width;
			
			$j('.mainimg img').width(maxWidth);				
			$j('.mainimg img').height(myHeight);
		}
		*/
		
		
		
        $j(".store-img .mainimg img").attr("src", $j(this).attr("rel"));
        
  });

});



function loadingCart(){
	$j(".addtocart .button").attr("value", "... Add to Cart ...");
}

function updateCart(){
	$j(".addtocart .button").attr("value", "Add to Cart");
	
	$j("#items").fadeOut(0, function(){
		$j("#items").fadeIn("slow");
	})
}


var myMainImg = "";
function setMainImgSize(imgLoc){
	
	//myMainImg = imgLoc != undefined ? imgLoc : myMainImg;
	myMainImg = imgLoc;

	var img = new Image();
	img.src = myMainImg;//$j(this).attr("rel");
	//alert(img.width + 'x' + img.height);
	//alert(imgLoc);
	
	if(img.width == "0" || img.width <= 0){
		//alert('noimg '+img.width+" : " +myMainImg);
		//setTimeout('setMainImgSize()', 500, [myMainImg]);
		//setMainImgSize(myMainImg);
	}else{
	
		if(img.width > img.height){
			var maxHeight = 290;
			if(img.height <= maxHeight){maxHeight=img.height;}

			var myWidth = (maxHeight*img.width)/img.height;
		
			$j('.mainimg img').width(myWidth);
			$j('.mainimg img').height(maxHeight);
			//TJPzoomamount=2.3;
			//TJPzoomwidth=70; 
			//TJPzoomheight=90;
		}else{
			var maxWidth = 200;

			var myHeight = (maxWidth*img.height)/img.width;
		
			$j('.mainimg img').width(maxWidth);				
			$j('.mainimg img').height(myHeight);
			//TJPzoomamount=1.5;
			//TJPzoomwidth=170; 
			//TJPzoomheight=190;
		}
	}
}

$j(document).ready(function() {
	
	$j('.navinator a').each(function(x){
		$j(this).bind("mouseup", function(e){
			//alert( $j(this).attr('rel') );
			
			setMainImgSize($j(this).attr("rel") );

		});
		
	});
	
	//$j('.mainimg').bind("mouseout", function(e){
	//	$j('.mainimg img').parent().css("overflow","hidden");
	//	$j('.mainimg img').parent().css("position","relative");
	//});
	
	$j('.mainimg img').bind("mouseover", function(e){
			
		//$j('.mainimg img').parent().css("overflow","visible");
		//$j('.mainimg img').parent().css("position","relative");
		
		//alert($j(this).attr("src"));
		//setMainImgSize( $j(this).attr("src") );
		
		//var img = new Image();
		//img.src = $j(this).attr("src");
		//alert(img.width + 'x' + img.height);
		
		/*if(img.width > img.height){
			var maxHeight = 300;
			var myWidth = (maxHeight*img.width)/img.height;
			
			$j('.mainimg img').width(myWidth);
			$j('.mainimg img').height(maxHeight);
			$j('.mainimg img').parent().css("overflow","visible");
			$j('.mainimg img').parent().css("position","relative");
			//TJPzoom($j('.mainimg img'));
			//TJPzoomamount=6.5;
		}else{
			var maxWidth = 200;

			var myHeight = (maxWidth*img.height)/img.width;
			
			$j('.mainimg img').width(maxWidth);				
			$j('.mainimg img').height(myHeight);
		}*/
		
    });
	
});




$j(document).ready(function() {
	
	$j('#order_cc_processor_id_0, #order_cc_processor_id_1').bind("click", function(e){
		//alert(this.value);
		if(this.value == "0"){
			//alert($(".paymentinformation"));
			$j(".paymentinformation").css("display", "block");
		}else{
			//alert($(".paymentinformation"));
			$j(".paymentinformation").css("display", "none");
		}
	});
	
});


function com_gam_disable()
{
	document.getElementById("radio_company_news_type").onclick = function() {
                if(this.checked) {
                        document.getElementById("gamnam").disabled = true;
                        document.getElementById("comnam").disabled = false;
                }
        }
	document.getElementById("radio_game_news_type").onclick = function() {
                if(this.checked) {
                        document.getElementById("gamnam").disabled = false;
                        document.getElementById("comnam").disabled = true;
                 }
        }
}