//別窓オープン
function openWin(obj,w,h,winName){
	if (jQuery) {	//jQueryをロード済みの環境の場合
		if ((obj.href) && (obj.href.match(/\.(jpg|png|gif)$/i))) {	//画像ならば何もしない。
			return false;	//(jquery.lightbox-0.5.jsで表示する)
		}
	}
	
	//jQueryをロードしていない環境。Mac IE5等で有効。
	var attr = "resizable=1,scrollbars=1,location=1,status=1,toolbar=1,directories=1,menubar=1";
	if(w){
		attr += ",width=" + w;
	}

	if(h){
		attr += ",height=" + h;
	}

	if (! winName){
		winName = "_blank";
	}
	
	var uri = '';
	if (obj.href) {
		uri = obj.href;
	} else if (typeof(obj) == 'string') {
		uri = obj;
	}
	
	var win = window.open(uri,winName,attr);
	win.focus();
	return false;
}

//roll over image
//Ex : <img src="1.gif" onmouseover="swapImg(this,'2.gif')" width="80" height="80" alt="">
function swapImg(obj,path){
	if(this.defSrc){
		(this.src == this.defSrc)?(this.src=this.swapSrc):(this.src =this.defSrc);
	}else if((! obj.defSrc) && (obj.src)){
		obj.defSrc = obj.src;
		obj.swapSrc = obj.src = path;
		obj.onmouseout = obj.onmouseover = swapImg;
	}
}

//--------debug用---------------------------------------------
//オブジェクトの全てのプロパティを表示する。(for debug) Ex : showAllProp(document);
function showAllProp(obj){
	var str = "";

	for(var i in obj){
		str += i + " : " + obj[i] + "<br />\n";
	}

	var win=window.open("",'newwin');
	win.document.write(str);
}

//================
//console.log定義
jQuery.noConflict();
jQuery(function($){	//onload event
	//console.log, console.dirが未定義の場合、自前で定義する。
	if (typeof window.console != 'object') {
		//$('body').prepend(($('<div id="_consoleBox"></div>')));	//create new element 先頭に追加
		$('body').append(($('<div id="_consoleBox"></div>')));	//create new element 最後に追加
		var consoleBox = $('#_consoleBox');
		console = {};
		console.log = function(obj){
			//consoleBox.html(consoleBox.html() + '<br />' + obj.toString());
			//consoleBox.html(obj.toString());
		}
		console.dir = function(obj){
			//consoleBox.html(obj.toString());
		}
	}
});










