$(function(){
	var imginfo = [
		{path:'images/img_ink.jpg', alt:"Ink Applicationl / SHIKOH serves as an excellent adhesive for UV inks used in plastics and printed matter, as well as displays outstanding pigment dispersal and UV curing properties. Read more..."},
		{path:'images/img_adhesive.jpg', alt:"Adhesive Application / SHIKOH provides strong binding strength with a thin coating and is ideal for quick printing applications. Read more..."}
	];
	
	var speed = 'slow';
	var showedno;
	
	(function init(){
		createElement();
		setNaviEvent();
	})();
	
	function createElement(){
		var html = '';
		var len = imginfo.length;
		for(var i=0; i<len; i++){
			html += '<div id="appImg'+ (i+1) +'" class="appImg"><img src="' + imginfo[i].path + '" width="850" height="270" alt="'+ imginfo[i].alt +'" /></div>';
		}
		$("#main").append(html);
	}
	function setNaviEvent(){
		$("#mainNav .nav").mouseover(function(evt){
			var id = evt.target.parentNode.id.replace("nav","");
			showImage(id);
		});	
		$("#mainNav .nav").mouseout(function(evt){
			hideImage();
		});	
	}
	function showImage(targetno){
		if(targetno == showedno) return false;
		
		if(showedno){
			$("#appImg"+showedno).stop(true, true).fadeOut(speed);
			showedno = -1;
		}
		
		$("#appImg"+targetno).stop(true, true).fadeIn(speed);		
		showedno = targetno;
	}
	function hideImage(){
		$("#appImg"+showedno).stop(true, true).fadeOut(speed);
		showedno = -1;
	}
});
