﻿function GuElementGet(GuElementA) {
if (document.getElementById) {
return document.getElementById(GuElementA);
}
else {
if (document.all) {
return document.all[GuElementA];
}
else {
if (document.layers) {
return document.layers[GuElementA];
}
else {
return (GuElementA);
}
}
}
}
document.write("<div id='GuAltTitleLayer' style='FILTER:alpha(opacity=97);width:auto;height:auto;border:1px #525252 solid;background:#ffffe1;padding:2px 4px 2px 4px;font-size:12px;color:#000000;text-align:left;position:absolute;z-index:600;display:none;'></div>");

function GuAltTitleShow(event) {
event=event||window.event;
var GuTarget=event.srcElement?event.srcElement:event.target;

if ((GuTarget.alt!="")&&(GuTarget.alt!=null)) {
GuTarget.AltTitleNote=GuTarget.alt;
GuTarget.alt="";
}
if ((GuTarget.title!="")&&(GuTarget.title!=null)) {
GuTarget.AltTitleNote=GuTarget.title;
GuTarget.title="";
}
if ((GuTarget.AltTitleNote!="")&&(GuTarget.AltTitleNote!=null)) {
GuElementGet("GuAltTitleLayer").style.display="";
GuElementGet("GuAltTitleLayer").innerHTML=GuTarget.AltTitleNote;
GuAltTitleWidth=GuElementGet("GuAltTitleLayer").clientWidth;
GuAltTitleHeight=GuElementGet("GuAltTitleLayer").clientHeight;

if (GuAltTitleWidth>=600) {
GuAltTitleWidth=600;
}

if ((event.clientY+20+GuAltTitleHeight)>(document.body.clientHeight)) {
GuAltTitleTop=-GuAltTitleHeight-40;
}
else {
GuAltTitleTop=0;
}

if ((event.clientX+10+GuAltTitleWidth)>(document.body.clientWidth)) {
GuAltTitleLeft=-GuAltTitleWidth-20;
}
else {
GuAltTitleLeft=0;
}

if ((event.clientX)||(event.clientY)) {
if ((document.body.scrollTop)||(document.body.scrollLeft)) {
GuAltTitleTop=(event.clientY)+20+(document.body.scrollTop)+GuAltTitleTop;
GuAltTitleLeft=(event.clientX)+10+(document.body.scrollLeft)+GuAltTitleLeft;
}
else {
GuAltTitleTop=(event.clientY)+20+(document.documentElement.scrollTop)+GuAltTitleTop;
GuAltTitleLeft=(event.clientX)+10+(document.documentElement.scrollLeft)+GuAltTitleLeft;
}
}
else {
GuAltTitleTop=(event.pageY)+20+GuAltTitleTop;
GuAltTitleLeft=(event.pageX)+10+GuAltTitleLeft;
}

if (GuAltTitleTop<=0) {
GuAltTitleTop=0;
}

if (GuAltTitleLeft<=0) {
GuAltTitleLeft=0;
}

GuElementGet("GuAltTitleLayer").style.top=GuAltTitleTop+"px";
GuElementGet("GuAltTitleLayer").style.left=GuAltTitleLeft+"px";
}
else {
GuElementGet("GuAltTitleLayer").style.display="none";
GuElementGet("GuAltTitleLayer").innerHTML="";
}
}
document.onmousemove=GuAltTitleShow; //跟隨滑鼠移動
//document.onmouseover=GuAltTitleShow; //不跟隨滑鼠移動


//賦予ID在清單連結
function myadmin_id_url(a){
     //alert(getCookie(cookienum+'estore%5Fmyidurl1'));

var arurl=document.getElementById(a).getElementsByTagName("a");
if (arurl.length>0){
 for (var is=0;is<arurl.length;is++){
  if (arurl[is].href.indexOf(siteurl)!=-1){
   if (arurl[is].href.indexOf("q=")==-1 && arurl[is].href.indexOf("c=")==-1){
     if (arurl[is].href.indexOf("?")!=-1){
     if (getCookie(cookienum+'estore%5Fmyidurl2')!=undefined)arurl[is].href=arurl[is].href+getCookie(cookienum+'estore%5Fmyidurl2');
     }else{
     if (getCookie(cookienum+'estore%5Fmyidurl1')!=undefined)arurl[is].href=arurl[is].href+getCookie(cookienum+'estore%5Fmyidurl1');
     }
   }    
  }
 }
}
var arurl=document.getElementById(a).getElementsByTagName("area");
if (arurl.length>0){
 for (var is=0;is<arurl.length;is++){
  if (arurl[is].href.indexOf(siteurl)!=-1){
   if (arurl[is].href.indexOf("q=")==-1 && arurl[is].href.indexOf("c=")==-1){
     if (arurl[is].href.indexOf("?")!=-1){
     if (getCookie(cookienum+'estore%5Fmyidurl2')!=undefined)arurl[is].href=arurl[is].href+getCookie(cookienum+'estore%5Fmyidurl2');
     }else{
     if (getCookie(cookienum+'estore%5Fmyidurl1')!=undefined)arurl[is].href=arurl[is].href+getCookie(cookienum+'estore%5Fmyidurl1');
     }
   }    
  }
 }
}
var arurl=document.getElementById(a).getElementsByTagName("form");
if (arurl.length>0){
 for (var is=0;is<arurl.length;is++){
  if (arurl[is].action.indexOf(siteurl)!=-1){
   if (arurl[is].action.indexOf("q=")==-1 && arurl[is].action.indexOf("c=")==-1){
     if (arurl[is].action.indexOf("?")!=-1){
     if (getCookie(cookienum+'estore%5Fmyidurl2')!=undefined)arurl[is].action=arurl[is].action+getCookie(cookienum+'estore%5Fmyidurl2');
     }else{
     if (getCookie(cookienum+'estore%5Fmyidurl1')!=undefined)arurl[is].action=arurl[is].action+getCookie(cookienum+'estore%5Fmyidurl1');
     }
   }
  }
 }
}
}

//加到我的最愛
function addBookmark(title, url){ 
if(navigator.appName.indexOf("Internet Explorer")!=-1){
window.external.AddFavorite(url, title); 
}else{
window.sidebar.addPanel(title, url, "") ;
}
}

//驗證
function yzmgo(size,map,g){
//瀏覽器 Firefox, Opera 8.0+, Safari, Internet Explorer 
var xmlhttp;
try { xmlhttp=new XMLHttpRequest(); }catch (e) {  try {xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch (e) {try {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch (e) { alert("Your browser does not support AJAX!"); return false;}}}
var strURL=map+'include/deljpg/deljpg.asp?size='+size+'&g='+g;
xmlhttp.open('GET',strURL+'&err999='+escape(new Date()),true);
xmlhttp.send(null);  
xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
document.getElementById(g).innerHTML="<img border='0' height='"+size+"' title='不區分大小寫' src='"+map+"include/deljpg/"+xmlhttp.responseText.split('|||')[1]+"'>";
//alert(xmlhttp.responseText);
}
}}
}
//讀取COOKIE
function getCookie(cookieName) { 
	var allcookies = document.cookie; 
	cookieName += "="; 
	var pos = allcookies.indexOf(cookieName); 
	if( pos != -1) { 
		var start = pos + cookieName.length; 
		var end = allcookies.indexOf(";",start); 
		if(end == -1) end = allcookies.length; 
		return unescape(allcookies.substring(start,end));  
	} 
} 
//刷新網頁
function go_reload(){ 
setTimeout('window.location.reload();',10);
}

//縮圖
function bbody(a,b){
if (b=='leftimg') var mmax="188"; //左自訂加框
if (b=='leftimga') var mmax="200"; //左自訂不加框
if (b=='rightimg') var mmax="751"; //右自訂加框
if (b=='rightimga') var mmax="763"; //右自訂不加框
if (b=='listimg') var mmax="740"; //商品詳細頁面
if (b=='newsimg') var mmax="740"; //新聞中心頁面
if (b=='pageimg') var mmax="763"; //客服中心與購物指南頁面
if (b=='maximg') var mmax="987"; //自訂加框
if (b=='maximga') var mmax="1003"; //自訂不加框

var arurl=document.getElementById(a).getElementsByTagName("img");
 if (arurl.length>0){
  for (var is=0;is<arurl.length;is++){
   if(arurl[is].width>50){
   if(arurl[is].width>mmax){
    heightok=((arurl[is].height * mmax) / arurl[is].width).toString();
    arurl[is].width=mmax; 
    arurl[is].height=heightok;
    arurl[is].style.width=mmax;
    arurl[is].style.height=heightok;
    //}else{
    //arurl[is].width=arurl[is].width; 
    //arurl[is].height=arurl[is].height; 
   }
   }
  }
 }
var arurl=document.getElementById(a).getElementsByTagName("embed");
 if (arurl.length>0){
  for (var is=0;is<arurl.length;is++){
   if(arurl[is].width>50){
   if(arurl[is].width>mmax){
    heightok=((arurl[is].height * mmax) / arurl[is].width).toString();
    arurl[is].width=mmax; 
    arurl[is].height=heightok;
    arurl[is].style.width=mmax;
    arurl[is].style.height=heightok;
    //}else{
    //arurl[is].width=arurl[is].width; 
    //arurl[is].height=arurl[is].height; 
   }
   }
  }
 }
 
}


//區塊背景顏色變化
//backgroundA(區塊ID,顏色1,顏色2,1=顏色1 2=顏色2 開始,速度毫秒)
function backgroundA(a,b,c,d,e){ 
  if (d==1){
     document.getElementById(a).style.background=b;
     setTimeout("backgroundA('"+a+"','"+b+"','"+c+"','2',"+e+");",e);
  }
  if (d==2){
     document.getElementById(a).style.background=c;
     setTimeout("backgroundA('"+a+"','"+b+"','"+c+"','1',"+e+");",e);
  }
}
//區塊內文字顏色變化
//backgroundA(區塊ID,顏色1,顏色2,1=顏色1 2=顏色2 開始,速度毫秒)
function backgroundB(a,b,c,d,e){ 
  if (d==1){
     document.getElementById(a).style.color=b;
     setTimeout("backgroundB('"+a+"','"+b+"','"+c+"','2',"+e+");",e);
  }
  if (d==2){
     document.getElementById(a).style.color=c;
     setTimeout("backgroundB('"+a+"','"+b+"','"+c+"','1',"+e+");",e);
  }
}
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked; 
}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//寫入COOKIES
function saveCookie(a,b) { 
//alert(a+"="+b);
document.cookie=a+"="+b
}

//推廣會員選單顯示隱藏
function showmidcode(buyok)
{
if(document.getElementById(buyok).style.display=="none"){
document.getElementById(buyok).style.display="";
} else {
document.getElementById(buyok).style.display="none"; 
}
}
//賦予ID在清單連結
function body_id_url(){
var rNo = Math.floor(Math.random()*8999+1000);
or1="?or="+rNo
or2="&or="+rNo
     //alert(getCookie(cookienum+'estore%5Fmyidurl1'));
var arurl=document.body.getElementsByTagName("a");
if (arurl.length>0){
 for (var is=0;is<arurl.length;is++){
  if (arurl[is].href.indexOf(location.host)!=-1 && arurl[is].href.indexOf("w=http:")==-1){
   //===============100808=================
   if (arurl[is].href.indexOf("or=")==-1){
     if (arurl[is].href.indexOf("?")!=-1){
     arurl[is].href=arurl[is].href+or2;
     }else{
     arurl[is].href=arurl[is].href+or1;
     }
   }
   //===============100808=================
  }
 }
}
var arurl=document.body.getElementsByTagName("area");
if (arurl.length>0){
 for (var is=0;is<arurl.length;is++){
  if (arurl[is].href.indexOf(location.host)!=-1 && arurl[is].href.indexOf("w=http:")==-1){
   //===============100808=================
   if (arurl[is].href.indexOf("or=")==-1){
     if (arurl[is].href.indexOf("?")!=-1){
     arurl[is].href=arurl[is].href+or2;
     }else{
     arurl[is].href=arurl[is].href+or1;
     }
   }
   //===============100808=================
  }
 }
}
}

