/*
 *  <div id="paramID">
 *     <img name="tab" show="" hide="" content=""/> 
 *     <img name="tab" show="" hide="" content=""/>
 *     ......
 *	</div>
 */
(function($) {
	$.fn.imgTabContent = function( paramID ){
		$target = $(this).find('img[@name="tab"]');
		$target.attr('style','cursor:pointer;');
		$target.click(function(){
			var clickContent = $(this).attr('content');
			var objs = $target;
			objs.each(function(i){
				var content = $(this).attr('content');
				var new_src = "";
				if( content == clickContent ){
					new_src = $(this).attr('show');
					$('#'+content).show();
				}else{
					new_src = $(this).attr('hide');
					$('#'+content).hide();
				}
				$(this).attr("src",new_src);
			});
			var clickContent = $(this).attr('content');
		});
	}
  $.fn.imageOverButton = function(){
    this.each(function(index){
      var $obj = $(this);
      var link = $obj.attr("href");
      if( link != null && link != "" )
      {
        $obj.css("cursor","pointer");
        $obj.click(function(){
          var $obj = $(this);
          var link = $obj.attr("href");
          if( link.indexOf("javascript:") == 0 )
          {
            eval(link.substring(11));
          }
          else
          {
            var target = $obj.attr("target");
            if( target == null || target == "" )
              location.href = link;
            else if( target == "_top" )
              top.location.href = link;
            else if( target == "_parent" )
              parent.location.href = link;
            else
              window.open(link,target);
          }
        });
      }
      if( $obj.attr("src_over") != null && $obj.attr("src_over") != "" )
      {
        $obj.attr("src_org",$obj.attr("src"));
        $obj.mouseover(function(){
          var $obj = $(this);
          $obj.attr("src",$obj.attr("src_over"));
        });
        $obj.mouseout(function(){
          var $obj = $(this);
          $obj.attr("src",$obj.attr("src_org"));
        });
      }
    });
    return this;
  };
})(jQuery);
