// JavaScript Document
//String.prototype.trim = function () {
    //return this.replace(/^\s*/, "").replace(/\s*$/, "");
//}
/*
cekYM = function(){
	$('#ym_mid a').each(function(i){
		$.ajax({
			url: "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22"+
				  encodeURIComponent('http://opi.yahoo.com/online?u=' + $(this).attr('rel') + '&m=t')+
				  "%22&format=xml'&callback=?",
			cache: false,
			dataType: 'json',
			timeout: 20000,
			success: function(data){
				if(data.results[0]){
					ym = $('#ym_mid a').eq(i).attr('rel');
					if(data.results[0].match("NOT ONLINE"))
					{
						$('#ym_mid a').eq(i).attr({'class': 'off', 'title': 'Send offline message to: ' + ym});
						$.ajax({url: "setym.php?id="+ym+"&sts=0"});
					}
					else
					{
						$('#ym_mid a').eq(i).attr({'class': 'on', 'title': 'Start a chat with: ' + ym});
						$.ajax({url: "setym.php?id="+ym+"&sts=1"});
					}
				}
			}
		});
	});
}
*/
$(document).ready(function()
{
	$("#search").focus(function(){
		if($(this).val().trim() == "search this website")
			$(this).val("");
	}).blur(function(){
		key = $(this).val().trim();
		if(key == '' || key.length == 0) $(this).val("search this website");
	});
	
	$("form").eq(0).submit(function(){
		str = $("#search").val().trim();
		if(str == '' || str == 'search this website' || str.length < 3)
		{
			alert("Keyword pencarian minimal 3 karakter.");
			return false;
		}
		else
			return true;
	});

	
	/*
	$(".ym_line:eq(0)").slideDown(500).siblings("div.ym_line").slideUp("slow");
	$(".ym_header").hover(function()
    {
	     $(this).next("div.ym_line").slideDown(500).siblings("div.ym_line").slideUp("slow");
	});
	*/
	
	//cekYM();
	//setInterval(cekYM, 30000);
});

