/*jQuery(document).ready(function($){
	if(jQuery('#col1').height() > jQuery('#sidebar').height()) {
		jQuery('#sidebar').height(jQuery('#col1').height());
	}
});*/


jQuery(document).ready(function(){

	//Tooltip
	//simple_tooltip(".h2title a","title-tooltip"); 
	
});

//Tooltip with jQuery 
function simple_tooltip(target_items, name){
 jQuery(target_items).each(function(i){
		jQuery("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+jQuery(this).attr('title')+"</p></div>");
		var my_tooltip = jQuery("#"+name+i);

		if(jQuery(this).attr("title") != ""){ // checks if there is a title

		jQuery(this).removeAttr("title").mouseover(function(){
				my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(340);
		}).mousemove(function(kmouse){
				my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
		}).mouseout(function(){
				my_tooltip.fadeOut(200);
		});

		}
	});
} ;


function showBanner(url, width, height, type) {
	switch(type) {
		case 'flash':
			showFlash(url, width, height);
			break;
		default:
		case 'image':
			showImage(url, width, height)
			break;
	}

}

function showFlash(url, width, height) {
	if(height == '' || height == 0 || height != 'undifined') {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ width +'" height="'+ height +'">');
		document.write('<param name="movie" value="'+ url +'" />');
		document.write('<param name="quality" value="high">');
		document.write('<param name="scale" value="exactfit" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<!--[if !IE]>-->');
		document.write('<object type="application/x-shockwave-flash" data="'+ url +'" width="'+ width +'" height="'+ height +'">');
		document.write('<!--<![endif]-->');
		document.write('<p>Alternative content</p>');
		document.write('<!--[if !IE]>-->');
		document.write('</object>');
		document.write('<!--<![endif]-->');
		document.write('</object>');

	} else {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ width +'">');
		document.write('<param name="movie" value="'+ url +'" />');
		document.write('<param name="quality" value="high">');
		document.write('<param name="scale" value="exactfit" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<!--[if !IE]>-->');
		document.write('<object type="application/x-shockwave-flash" data="'+ url +'" width="'+ width +'">');
		document.write('<!--<![endif]-->');
		document.write('<p>Alternative content</p>');
		document.write('<!--[if !IE]>-->');
		document.write('</object>');
		document.write('<!--<![endif]-->');
		document.write('</object>');	
	}
}

function showImage(url, width, height) {
	if(height == '' || height == 0 || height != 'undifined')
		document.write('<img src="'+ url +'" width="'+ width +'" alt="" />');
	else
		document.write('<img src="'+ url +'" width="'+ width +'" height="'+ height +'" alt="" />');
}


window.onload = initLoad;
	
function initLoad() {
	if(getSearchKeyword!='') jQuery('#s').val(getSearchKeyword);
}

/*** Search ***/
function keywordFocus(ob){
	if(ob.val() == defSearchKeyword) ob.val('');
}

function keywordBlur(ob){
	if(ob.val() == '') ob.val(defSearchKeyword);
}

/*** Comment ***/
function commentAuthorFocus(ob){
	if(ob.val() == defCommentAuthor) ob.val('');
}

function commentAuthorBlur(ob){
	if(ob.val() == '') ob.val(defCommentAuthor);
}

function commentEmailFocus(ob){
	if(ob.val() == defCommentEmail) ob.val('');
}

function commentEmailBlur(ob){
	if(ob.val() == '') ob.val(defCommentEmail);
}

function commentUrlFocus(ob){
	if(ob.val() == defCommentUrl) ob.val('');
}

function commentUrlBlur(ob){
	if(ob.val() == '') ob.val(defCommentUrl);
}


function isEmail(s){
	var re	= /^(\w|[^_]\.[^_]|[\-])+(([^_])(\@){1}([^_]))(([a-z]|[\d]|[_]|[\-])+|([^_]\.[^_]) *)+\.[a-z]{2,3}$/i;
	return re.test(s);
}

function isUrl(s){
	var re	= /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	return re.test(s);
}
