// JavaScript Document
//
$(document).ready(function(){
  $(".content-left-border-cate1>a").addClass("cateori");
  $(".content-left-border-cate1").mouseover(function(){
    $(this).removeClass("cateori");
	$(this).addClass("catech");
	$(this).find("a").removeClass("cateori");
	$(this).find("a").addClass("catech");
  });
  $(".content-left-border-cate1").mouseout(function(){
    $(this).addClass("cateori");
	$(this).removeClass("catech");
	$(this).find("a").addClass("cateori");
	$(this).find("a").removeClass("catech");
  });
  
  $(".home-banner-down-line>img").click(function(){
    clearInterval(timer);
	var thisimg=$(this).attr("value");
	for(i=1;i<5;i++){
	  var chborder="down-pic-"+i;
	  if(i!=thisimg){
		$("#"+chborder).css("border-color","#999");
	  }else{
		$("#"+chborder).css("border-color","#09F");
	  }
	}
	if(thisimg=='1'){
	  $("#home-banner-in").animate({left:0},500,function(){
		 document.getElementById('picm').value=1;
		 timer=setInterval("movepics()",5000);
	  });
	}else if(thisimg=='2'){
	  $("#home-banner-in").animate({left:-530},500,function(){
	     document.getElementById('picm').value=2;
		 timer=setInterval("movepics()",5000);
	  });
	}else if(thisimg=='3'){
	  $("#home-banner-in").animate({left:-1060},500,function(){
	     document.getElementById('picm').value=3;
		 timer=setInterval("movepics()",5000);
	  });
	}else if(thisimg=='4'){
	  $("#home-banner-in").animate({left:-1590},500,function(){
	     document.getElementById('picm').value=4;
		 timer=setInterval("movepics()",5000);
	  });
	}
  });
})
//
/**/
function refreshcode(target){
	var a=document.getElementById(target);
	a.src=a.src+'?';
	}
/**/
//
function chbundle(){
  var bundleno=document.getElementById('bundle').value;
  var oriprotitle=document.getElementById('oriprotitle').value;
  var oriprouprice=document.getElementById('oriprouprice').value*1;
  var protitle=document.getElementById('protitle');
  var prouprice=document.getElementById('prouprice');
  if(bundleno=='0'){
    protitle.value=oriprotitle;
	prouprice.value=oriprouprice;
  }else{
	var bundlename='probundlename_'+bundleno;
    var probundlename=document.getElementById(bundlename).value;
	var bundlecost='probundlecost_'+bundleno;
    var probundlecost=document.getElementById(bundlecost).value*1;
	protitle.value=oriprotitle+"-plus-"+probundlename;
	prouprice.value=oriprouprice+probundlecost;
  }
}
//
/**/
function movepics(){
  var picm=document.getElementById('picm').value;
  if(picm=='1'){
    document.getElementById('picm').value=2;
	$("#home-banner-in").animate({left:-530},500);
	$("#down-pic-1").css("border-color","#999");
	$("#down-pic-2").css("border-color","#09F");
  }else if(picm=='2'){
    document.getElementById('picm').value=3;
	$("#home-banner-in").animate({left:-1060},500);
	$("#down-pic-2").css("border-color","#999");
	$("#down-pic-3").css("border-color","#09F");
  }else if(picm=='3'){
    document.getElementById('picm').value=4;
	$("#home-banner-in").animate({left:-1590},500);
	$("#down-pic-3").css("border-color","#999");
	$("#down-pic-4").css("border-color","#09F");
  }else if(picm=='4'){
    document.getElementById('picm').value=1;
	$("#home-banner-in").animate({left:0},500);
	$("#down-pic-4").css("border-color","#999");
	$("#down-pic-1").css("border-color","#09F");
  }
}
/**/
