/*
 * library.js 1.1
 * pre-require: jQuery v1.3.2
 * 2011/08/02
 */


/*--- RollOver ---*/

$(function initRollOverImages() {
	var image_cache = new Object();
	$("img.btn").each(function(i) {
		var imgsrc = this.src;
		var fileName = imgsrc.replace(/\\/g,'/').replace(/.*\//, '');
		if((fileName.indexOf("_on.")) == -1 && (fileName.indexOf("_in.")) == -1 ){
			var dot = this.src.lastIndexOf('.');
			var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
			image_cache[this.src] = new Image();
			image_cache[this.src].src = imgsrc_on;
			$(this).hover(
				function() { this.src = imgsrc_on; },
				function() { this.src = imgsrc; }
			);
		}
	});
});







/*--- searchbox ---*/
$(function(){
    $("input.search-tx").focus(function() {
        if($(this).val() == $(this).attr('defaultValue'))
            $(this).css('color', '#666666').val('');
    }).blur(function() {
        if(jQuery.trim($(this).val()) == "") {
            $(this).css('color', '#999999').val($(this).attr('defaultValue'));
        }
    });
});



/*--- bookmark ---*/
function addBookmark() {
	shareTitle = document.title;
	shareUrl = document.URL;
	if (window.sidebar) {
		window.sidebar.addPanel(shareTitle, shareUrl,"");
	} else if( document.all ) {
		window.external.AddFavorite( shareUrl, shareTitle);
	} else if( window.opera && window.print ) {
		return true;
	}
}




/*--- OpenWindow ---*/

$(function windowOpen () {
	$("a.label-window").click(function(){
		window.open($(this).attr("href"), 'popup', "width=970, height=625, location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no, left="+(window.screen.width-970)/2);
		return false;
		}
	);
});


$(function treeOpen () {
	$("a.tree").click(function(){
		window.open($(this).attr("href"), 'popup', "width=800, height=500, location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no, left="+(window.screen.width-800)/2);
		return false;
		}
	);
});


