
var gDetail = {
	cat_id:0
};


function initShowText(){
	$("*[language]").each(function(i){
		var language = $(this).attr("language") || '';
		
		if(language!=''){
			var type = language.split(",");
			var arr = "";
			for(var j=0;j<type.length;j++){
				arr += "['"+type[j]+"']";
			}
			eval("var val=txt"+arr);
			if(arr == '[company]["en_US"]["address"]'){
				$.log(arr);	
			}
			var tag = this.tagName.toLowerCase();
			if(tag == "input"){
				$(this).val(val);
			}else{
				$(this).html(val);
			}		
			//$.log(tag);
			
		}
	});
	
	
}


function initCategoryText(){
	if(gProduct.cat_id == 0){
		$("#categoryInfo").html("All category");
	}else{
		var catText = "<a href='product.php?c="+gProduct.cat_id+"'>"+$("#category").find("a[id='"+gProduct.cat_id+"']:first").html()+"</a>";
		for(var i=0;i<gCategory.data.length;i++){
			if(gCategory.data[i]["id"] == gProduct.cat_id && gCategory.data[i]["fid"] != 0){
				for(var j=0;j<gCategory.data.length;j++){
					if(gCategory.data[j]["id"] == gCategory.data[i]["fid"]){
						catText = "<a href='product.php?c="+gCategory.data[j]["id"]+"'>"+gCategory.data[j]["value"]+"</a>"+" --- "+catText;
						break;
					}
				}
				break;
			}
		}
		$("#categoryInfo").html(catText);
	}	
}

function initItemB(){
	$("div[sort='item']").mouseover(function(){
		//$(this).css("border","blue solid 1px");
	}).mouseout(function(){
		//$(this).css("border","#C0C0C0 solid 1px");
	}).click(function(){
		location.href = "detail.php?pid="+$(this).attr("id");
	});
}

function initMarketLanguageEvent(){

	$("#selet01").mouseover(function(){
		$("#selet01_list").show();									 
	}).mouseout(function(){
		$("#selet01_list").hide();
	});
	
	$("#selet02").mouseover(function(){
		$("#selet02_list").show();									 
	}).mouseout(function(){
		$("#selet02_list").hide();
	});
	
	
	$("#selet04").hover(function(){
		$("#selet04_list").show();		
		//$("#foot_id").height("160px");	
	},function(){
		$("#selet04_list").hide();
		//$("#foot_id").height("60px");	
	});
	
	$("#selet05").hover(function(){
		$("#selet05_list").show();	
		//$("#foot_id").height("160px");	
	},function(){
		$("#selet05_list").hide();
		//$("#foot_id").height("60px");	
	});


}


