function slideSwitch() {
    var $active = $('#slideshow div.active');
    if ( $active.length == 0 ) $active = $('#slideshow div:last');
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow div:first');
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval( "slideSwitch()", 5000 );
});

function Clear() {
 qstr.value='';
 qstr.style.color="000"
}
function trimcode(str){
 str = str.toLowerCase();
 str=str.replace(/(^\s*)|(\s*$)/g, "");
 var reg=new RegExp(" ","g");
 str=str.replace(reg,"_");
 return encodeURI(str);
}
function q() {
   var sform=document.getElementById('sform');
   var key=document.getElementById('query');
	if (key.value == ""||key.value == "Entry keywords here.")
	{
	alert("Please input a word.");
	 key.focus();
	 return false;
	}
	else {
	sform.action="/q-"+trimcode(key.value)+".html";
	sform.submit();
	}
   }
function IsValid(e)
{
var evt = window.event|| e;
if (evt.keyCode == 13)
    {
	var sform=document.getElementById('sform');
	var key=document.getElementById('query');
	if (key == "")
	{
	alert("Please input a word.");
	 key.focus();
	 return false;
	}
	else {
	sform.action="/q-"+trimcode(key.value)+".html";
	sform.submit();
	}
    }
}

function gs(d,a){
  if (d.currentStyle){
    var curVal=d.currentStyle[a]
  }else{
    var curVal=document.defaultView.getComputedStyle(d, null)[a]
  }
  return curVal;
}

//float navagition for jquery
$(function(){
	$('#menulist li').hover(function(){
		$(this).children('ul').stop(true,true).show('slow');
	},function(){
		$(this).children('ul').stop(true,true).hide('slow');
	});

	$('#menulist li').hover(function(){
		$(this).children('div').stop(true,true).show('slow');
	},function(){
		$(this).children('div').stop(true,true).hide('slow');
	});
});

//add url to explorer
function addBookmark(webtitle,url) {
if (window.sidebar) {
window.sidebar.addPanel(webtitle, url,"");
} else if( document.all ) {
window.external.AddFavorite( url, webtitle);
} else if( window.opera && window.print ) {
return true;
}
}
