
 $(document).ready(function(){	
		piccent();	
		production();
		productiondtl();
	});
 
 function piccent(){	
		 $(".picture img").css("display","none");
		 $(".picture").css("background","url("+$(".picture img").attr("src")+") center top no-repeat");	 
	 }
	 
 function production(){	

		$("table.production td").hover(function() {
			if($(this).attr("class")!="tdempty") $(this).toggleClass("tdhov");							
			 },function() {
			$(this).removeClass("tdhov");				
			});
	 }
	 
  function productiondtl(){	
		
		cnt = $("table.production.pdetail td").size();		
		emp = $("table.production.pdetail td.tdempty").size();		
		tdcnt = cnt-emp;
		el = $("table.production.pdetail td .proddtls .id");
		
		bpid = $(".bigpicture .id").html();
		 		
		for(i=0;i<tdcnt;i++){
  			if($(el[i]).html()==bpid) 
				{
				$(el[i]).parents("td").toggleClass("tdact");
				$(".modelinf .bigpicture .tdid").html(i+1);
				if(i==0) $(".modelinf .nav .prev img").css("display","none");
				if(i==(tdcnt-1)) $(".modelinf .nav .next img").css("display","none");
				
				previd = $(el[i-1]).html(); 
				nextid = $(el[i+1]).html();
				
				if(previd) $(".modelinf .nav .prev a").attr("href",previd+".html#bigpic");
				if(nextid) $(".modelinf .nav .next a").attr("href",nextid+".html#bigpic");
				}
		}
		
		/*$("table.production.pdetail td").click(function() {
			if($(this).attr("class")!="tdempty"){
					mId = $(this).find(".proddtls .id").html();
					mName = $(this).find(".proddtls .name").html();
					mSrc = $(this).find(".proddtls .src").html();
					mUrl = $(this).find(".proddtls .url").html();
					mDescr = $(this).find(".proddtls .descr").html();
					
					$(".modelinf .bigpicture .image").html("<img src=\"resimg.php@FILENAME="+mSrc+"&TYPE=1&WIDTH=663&HEIGHT=308&QUALITY=100\" alt=\""+mName+"\" title=\""+mName+"\" />");
					//$(".modelinf .bigpicture .descr").html(mDescr);
					$(".modelinf .nav .list").html(mDescr);
					$(".modelinf .bigpicture .id").html(mId);
					$("table.production.pdetail td.tdact").removeClass("tdact");
					$(this).toggleClass("tdact");

					el = $("table.production.pdetail td .proddtls .id")
					for(i=0;i<tdcnt;i++){
						if($(el[i]).html()==mId)  {
							$(".modelinf .bigpicture .tdid").html(i+1);
							if(i==0) {$(".modelinf .nav .prev img").css("display","none"); if(tdcnt!=1) $(".modelinf .nav .next img").css("display","block"); }
							else if(i==(tdcnt-1)) {$(".modelinf .nav .next img").css("display","none"); if(tdcnt!=1) $(".modelinf .nav .prev img").css("display","block"); }
							else if(tdcnt!=1) {$(".modelinf .nav .next img").css("display","block"); $(".modelinf .nav .prev img").css("display","block"); }
							}
						}	
				}
			});*/
		
		/*$(".modelinf .nav a").click(function() {
				tdid = $(".modelinf .tdid").html();
				if($(this).parents("div").attr("class")=="prev") 
						tdid=tdid*1-1;						
				if($(this).parents("div").attr("class")=="next") 
						tdid=tdid*1+1;	
						
						$("table.production.pdetail td.tdact").removeClass("tdact");						
						
						mId = $("table.production.pdetail td#"+(tdid)).find(".proddtls .id").html();
						mName = $("table.production.pdetail td#"+(tdid)).find(".proddtls .name").html();
						mSrc = $("table.production.pdetail td#"+(tdid)).find(".proddtls .src").html();
						mUrl = $("table.production.pdetail td#"+(tdid)).find(".proddtls .url").html();
						mDescr = $("table.production.pdetail td#"+(tdid)).find(".proddtls .descr").html();
						
						$(".modelinf .bigpicture .image").html("<img src=\"resimg.php@FILENAME="+mSrc+"&TYPE=1&WIDTH=663&HEIGHT=308&QUALITY=100\" alt=\""+mName+"\" title=\""+mName+"\" />");						//$(".modelinf .bigpicture .descr").html(mDescr);
						$(".modelinf .nav .list").html(mDescr);
						$(".modelinf .bigpicture .id").html(mId);
						$(".modelinf .bigpicture .tdid").html(tdid);
						$("table.production.pdetail td#"+(tdid)).toggleClass("tdact");
						
						if(tdid==1) {$(".modelinf .nav .prev img").css("display","none"); $(".modelinf .nav .next img").css("display","block"); }
						else if(tdid==tdcnt) {$(".modelinf .nav .next img").css("display","none"); $(".modelinf .nav .prev img").css("display","block"); }												
						else if(tdcnt!=1) {$(".modelinf .nav .next img").css("display","block"); $(".modelinf .nav .prev img").css("display","block"); }
			});		*/
		
	 }
	 
	 // JavaScript Document