﻿// JavaScript Document
function getid(objid){
	return document.getElementById(objid);
}
function getPath(){
	var arrUrl=window.location.href.split("/");
	var strPage=arrUrl[arrUrl.length-1];
	var arrFile=strPage.split("?");
	var strPath=arrFile[0].toLowerCase();
	return strPath;
}
function init(){
	getid("nva1").onmouseover=function(){ getid("nva1").style.backgroundImage="url(images/m2_01.gif)"; }
	getid("nva2").onmouseover=function(){ getid("nva2").style.backgroundImage="url(images/m2_02.gif)"; }
	getid("nva3").onmouseover=function(){ getid("nva3").style.backgroundImage="url(images/m2_03.gif)"; }
	getid("nva4").onmouseover=function(){ getid("nva4").style.backgroundImage="url(images/m2_04.gif)"; }
	getid("nva5").onmouseover=function(){ getid("nva5").style.backgroundImage="url(images/m2_05.gif)"; }
	getid("nva6").onmouseover=function(){ getid("nva6").style.backgroundImage="url(images/m2_06.gif)"; }
	getid("nva7").onmouseover=function(){ getid("nva7").style.backgroundImage="url(images/m2_07.gif)"; }
	getid("nva8").onmouseover=function(){ getid("nva8").style.backgroundImage="url(images/m2_08.gif)"; }
	getid("nva9").onmouseover=function(){ getid("nva9").style.backgroundImage="url(images/m2_09.gif)"; }

	getid("nva1").onmouseout=function(){ getid("nva1").style.backgroundImage=""; }
	getid("nva2").onmouseout=function(){ getid("nva2").style.backgroundImage=""; }
	getid("nva3").onmouseout=function(){ getid("nva3").style.backgroundImage=""; }
	getid("nva4").onmouseout=function(){ getid("nva4").style.backgroundImage=""; }
	getid("nva5").onmouseout=function(){ getid("nva5").style.backgroundImage=""; }
	getid("nva6").onmouseout=function(){ getid("nva6").style.backgroundImage=""; }
	getid("nva7").onmouseout=function(){ getid("nva7").style.backgroundImage=""; }
	getid("nva8").onmouseout=function(){ getid("nva8").style.backgroundImage=""; }
	getid("nva9").onmouseout=function(){ getid("nva9").style.backgroundImage=""; }
	
	path=getPath();
	switch(path){
		case "product.asp":
		case "product_m.asp":
		case "product_f.asp":
			getid("nva2").parentNode.style.backgroundImage="url(images/m3_02.gif)";
			break
		case "news.asp":
			getid("nva3").parentNode.style.backgroundImage="url(images/m3_03.gif)";
			break
		case "salenet.asp":
			getid("nva4").parentNode.style.backgroundImage="url(images/m3_04.gif)";
			break
		case "member.asp":
			getid("nva5").parentNode.style.backgroundImage="url(images/m3_05.gif)";
			break
		case "order.asp":
			getid("nva6").parentNode.style.backgroundImage="url(images/m3_06.gif)";
			break
		case "job.asp":
			getid("nva7").parentNode.style.backgroundImage="url(images/m3_07.gif)";
			break
		case "contact.asp":
			getid("nva8").parentNode.style.backgroundImage="url(images/m3_08.gif)";
			break
		case "about.asp":
			getid("nva9").parentNode.style.backgroundImage="url(images/m3_09.gif)";
			break
		default:
			getid("nva1").parentNode.style.backgroundImage="url(images/m3_01.gif)";
	}
}

function showpic(url){
	var spic=window.open("pic.asp?p="+url,"showpic","width=620,height=520");
	spic.focus();
}
function openNewWin(winUrl,winName,winWidth,winHeight){
	window.open(winUrl,winName,"width="+winWidth+",height="+winHeight+",scrollbars=no,toolbar=no, status=no, menubar=no, resizable=no")	
}
function openwin(url){
	if($(".d2009flash").html()!=null)
		$(".d2009flash").show();
	else
	{
		var newDiv=document.createElement("div");
		newDiv.className="d2009flash";
		newDiv.innerHTML='<a href="javascript:closewin();" class="close"></a><iframe class="d2009flashDiv" src="'+url+'" width="100%" height="100%" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>';
		document.body.appendChild(newDiv);
	}
	return false;
}
function openvideo(){
	if($(".dvideo").html()!=null)
	{
		$(".dvideo").show();
		document.getElementById("flashvideo").play();
	}
	else
	{
		var newDiv2=document.createElement("div");
		newDiv2.className="dvideo";
		newDiv2.innerHTML='<a href="javascript:closewin();" class="close"></a>'+returnFlash("flash/playcn.swf",640,480,"flashvideo");
		document.body.appendChild(newDiv2);
	}
	return false;
}
function closewin(){
	$(".d2009flash, .dvideo").hide();
	if($("#flashvideo"))
		document.getElementById("flashvideo").stop();
}
	
function flashzone(str){
	//window.location="getsalenet.asp?ClassID=1&wd="+ encodeURI(str);
	$.get("getsalenet.asp?ClassID=1&wd="+ encodeURI(str)+"&t="+Math.random(),function(data){
		salepic();
		$(".saleList").html(data);
	});
}

$(document).ready(function(){
	$("#2009pic").load(function(){
		$(".picLoad").hide(500);
		$("#2009pic").animate({opacity: 'show'});
		//autoscroll();
	});
	
	$(".d2009mid a").click(function(){
//		$(".picLoad").show(500);
//		$("#2009pic").animate({opacity: 'hide'});
//		$("#2009pic").animate({src: $(this).attr("href")});
		$(".productPic").hide(0).animate({opacity: 'show'});
		$(".productPic").html(returnFlash("flash/2009.swf?path="+$(this).attr("href"),320,250,""));
		$(".noteBottom").html($(this).attr("title"));
		return false;
	});
	$(".d2009mid a:first").click();
	
//	$("#2009pic").mousemove(function(){
//		//$("#2009pic").css("position","relative");
//		var tpos = $(".d2009right").offset();
//		var picpos = $("#2009pic").offset();
//		var x = event.x - tpos.left;
//		var y = event.y - tpos.top;
//		var ntop=0;
//		
//		if(y>125)
//		{
//			ntop = 120;
//		}
//		else
//		{
//			ntop = 20;
//		}
//		$("#2009pic").animate({top:ntop+"px"});
//		
//		document.title = ntop+ ","+y+ ","+picpos.left+ ","+picpos.top;
//	});
});

function autoscroll()
{
	$("#2009pic").mousemove(function(){
		var h = $(this).height();
		if(h>260)
		{
			var tpos = $(".d2009right").offset();
			var l = event.x - tpos.left;
			var t = event.y - tpos.top;
			if(t < 150)
			{
				document.title = "u - ";
//				//$(".d2009right").animate({ scrollTop : 0 }, "slow");
//				//$(".d2009right").scrollTop(0);
				$("#2009pic").top(0);
			}
			else
			{
				document.title = "d - ";
//				//$(".d2009right").animate({ scrollTop : (h-260) }, "slow");
//				//$(".d2009right").scrollTop(h-260);
				$(this).animate({top : "300px"}, "slow");
			}
			document.title += " : " + t + " - " + h;
		}
	});
}

function salepic(){
	$(".salepic_h").animate({bottom: '+140px'}, 2000);
	$(".salepic_f").animate({bottom: '-140px'}, 2000);
}