// JavaScript Document

// ======================= news ,faq
try{
	(function($){
		$.extend({
			faqToggle : function(obj){
			obj.target.hide();
				obj.trigger.click(function(){
					reloadImg ();				   
					$(this)
					.toggleClass("answer")
					.next("dd")
					.toggle();				   
				})					
			},
			toggleMenu : function(){
				
				$("#localNav .parent a").click(function(){

					$(this).parent().toggleClass("on");
													  
				})
				
			},
			equalHeight : function(group){
				var tallest = "";
				group.each(function() {
					thisHeight = $(this).height();
					if(thisHeight > tallest) {
						tallest = thisHeight;
					}
				});
				group.height(tallest);				
				
			},
			newIcon : function(obj){
				
				var obj = $.extend({
					kikan : 30,	
					today :new Date(),
					icon : "<img src='images/icon_cm_new.gif' alt='new' style='margin-bottom:5px;display:block;'>",
					items : $(".setL")
				},obj || {});
				
				obj.items.each(function(){										
					
					
					var date = $(this).find(".upday").text().split(".");
					var y = date[0];
					var m = date[1];
					var d = date[2];					
					var upday = new Date(y, m - 1, d)
					
					var difference = obj.today.getTime() - upday.getTime();
					
					difference = difference / (1000 * 60 * 60 * 24);
					//alert(difference);
					if (difference < obj.kikan) {
						$(this).find("dt").prepend(obj.icon);
					}

				});
			}
		});
	})(jQuery);
}catch(e){

}

function reloadImg (){
		var newhsrc = '/common/images/icon_arrow_red_under.gif'
		newImg = new Image();
		newImg.src = newhsrc;
}


/* ================================== /company/info/index.html map print */
function mapPrint(){
	var cPrint = document.getElementsByTagName('link');
	for (var i = 0; i < cPrint.length; i++){
		if(cPrint[i].media == 'print'){
			cPrint[i].href = "/common/css/print/print_map.css";
			//cPrint[i].media = 'screen,print'; //check
			window.print();
		}
	}
}


// ======================= /csr/sports/A/company/office/index.html map over
function changeimg(src) {
	var mapSrc = document.getElementById("map");
	mapSrc.src = src;
}
function CIOut(){
	document.getElementById("map").src = 'images/index_map.gif';
}

// ======================= /recipe/ popup mouseover
function recipemouseon(src, target){
	var orgImg = src;
	var pos = orgImg.lastIndexOf(".");
	var onImg = orgImg.substr(0,pos) + "_on.jpg";
	target.src = onImg;
}

function recipemouseout(src, target){
	var onImg = src;
	var outImg = onImg.split("_on")[0] + ".jpg";
	target.src = outImg;
}


