
function addBookmarkForBrowser(sTitle, sUrl)
{
  var userAgent = navigator.userAgent.toLowerCase();
  var browser = {
    version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
    safari: /webkit/.test( userAgent ),
    opera: /opera/.test( userAgent ),
    msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
    mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  }

  if (browser.mozilla) {
    addBookmarkForBrowser = function(sTitle, sUrl) {
      window.sidebar.addPanel(sTitle, sUrl, "");
    }
  } else if (browser.msie) {
    addBookmarkForBrowser = function(sTitle, sUrl) {
      window.external.AddFavorite(sUrl, sTitle);
    }
  } else if (browser.safari) {
    addBookmarkForBrowser = function() {
      alert("do it yourself");
    }
  } else {
    addBookmarkForBrowser = function() {
      alert("do it yourself");
    }
  }
  return addBookmarkForBrowser(sTitle, sUrl);
}

var $jQuery = jQuery.noConflict();

$jQuery(document).ready(function(){
		
	// PNG 在 IE5.5 IE6 透明及滑鼠改變圖像
  $jQuery("img[src$=_out.png]")
		.ifixpng()
    .css({cursor: 'pointer'})
    .hover(
      function () {
        $jQuery(this).iunfixpng();
				var over_src = this.src.substring(0, this.src.lastIndexOf('_out.png')) + '_over.png';
				$jQuery(this).attr('src', over_src).ifixpng();
      },
      function () {
        $jQuery(this).iunfixpng();
				var out_src = this.src.substring(0, this.src.lastIndexOf('_over.png')) + '_out.png';
        $jQuery(this).attr('src', out_src).ifixpng();
      }
    );	
  
	// 全部 PNG 在 IE5.5 IE6 透明
  $jQuery('img[src$=.png], .pngz').ifixpng().iunfixpng().ifixpng();
	
	
	// GIF JPG 滑鼠改變圖像
  $jQuery("img[src$=_out.gif], img[src$=_out.jpg], input[src$=_out.gif], input[src$=_out.jpg]")
    .css({cursor: 'pointer'})
    .hover(
      function () {
        var over_src = this.src.substring(0, this.src.lastIndexOf('_out' + this.src.substring(this.src.lastIndexOf('.')))) + '_over' + this.src.substring(this.src.lastIndexOf('.'));
        $jQuery(this).attr('src', over_src);
      },
      function () {
       var out_src = this.src.substring(0, this.src.lastIndexOf('_over' + this.src.substring(this.src.lastIndexOf('.')))) + '_out' + this.src.substring(this.src.lastIndexOf('.'));
        $jQuery(this).attr('src', out_src);
      }
    );
		
		
		// 切換語言
		$jQuery('#Languages_btn').hover(
			function(){
				$jQuery('#Languages_list').slideDown("fast");
				}
			,
			function(){
				$jQuery('#Languages_list').slideUp("fast");
				}
		);				
		// worldwide開關
		$jQuery("#open_ww_btn").click(function () {
      $jQuery('.worldwide').slideDown("fast");
		});
		$jQuery("#close").click(function () {
      $jQuery('.worldwide').slideUp("fast");
		});
		// 首頁NEWS more開關
		$jQuery("#moreews").click(function () {
      $jQuery('.iNews_TB_L3').slideToggle(600);
    });
		// A錨點動畫(TOP)
		$jQuery('a.top_btn').click(function(){
			// 讓捲軸用動畫的方式移動到 0 的位置
			$jQuery('html, body').animate({
				scrollTop: 0
			}, 900);

			return false;
		});

		
});
