var $jQuery = jQuery.noConflict();

$jQuery(document).ready(function() {
 	//當九宮格的圖片 被點擊 的時候
	$jQuery(".gridarea img").click(function(){
		//先將觸發事件的物件放入變數中等待未來使用
		var $jQueryimg = $jQuery(this);
		//先將大圖淡出
		$jQuery(".showarea img").fadeOut(function(){
			//因為更改屬性動作不屬於動畫事件
			//因此要把更改屬性放在淡出的 CALLFUNC 內
			//才可以確定淡出以後才換圖片連結
			//最後再將圖片淡入
			$jQuery(".showarea img").attr("src",$jQueryimg.attr("rel")).fadeIn();
		});
	});
 });

swfobject.embedSWF('swf/menu.swf', 'swf_menu', '1000', '101', '9', 'swf/expressInstall.swf', {}, {wmode: 'transparent',menu: false}, {});

//搜尋欄位移除背景
$jQuery(document).ready(function() {
  $jQuery("input[name='keywords']")
    .focus(function(){
      $jQuery(this).removeClass("inputKeywords");
    })
    .blur(function(){ 
      if (this.value.length == 0) {
        $jQuery(this).addClass("inputKeywords");
      }
      else {
        $jQuery(this).removeClass("inputKeywords");
      }
    });
}); 


function AddFavorite (shop_url, shop_title)
{
	alert('OK');
	window.external.AddFavorite(shop_url, shop_title);
}

function addBookmarkForBrowser(sTitle, sUrl)
{
	if (window.sidebar && window.sidebar.addPanel) {
		addBookmarkForBrowser = function(sTitle, sUrl) {
			window.sidebar.addPanel(sTitle, sUrl, "");
		}
	} else if (window.external) {
		addBookmarkForBrowser = function(sTitle, sUrl) {
			window.external.AddFavorite(sUrl, sTitle);
		}
	} else {
		addBookmarkForBrowser = function() {
			alert("do it yourself");
		}
	}
	return addBookmarkForBrowser(sTitle, sUrl);
}



$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]').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);
      }
    );
});
