// Javascript Document

function roll_over(img_name, img_src) {
   document[img_name].src = img_src;
}

/*window.onload = prepareSearchFields;
function prepareSearchFields() {
  if(!document.getElementById) return false;
  var searchField = document.getElementById("searchbox");
  var defaultValue = searchField.defaultValue;
  searchField.onfocus = function() {
    if(searchField.value == defaultValue) {
      searchField.value = "";
    }
  }
  searchField.onblur = function() {
    if(searchField.value == "") {
      searchField.value = defaultValue;
    }
  }
}*/


$(document).ready( function(){
	accordion();
	//autoFill($("#srh"), "keyword");
	//backtoTop(); 
	//printPage();
});

function accordion() {
		//hide the all of the element with class msg_body
	$(".acc-content").hide();
	$('#elm1').show();
	var el;
	var divel=$('#kui-accordion');
	//slides the element with class "msg_body" when paragraph with class "msg_head" is clicked 
	$("#kui-accordion h3").click(function()
    {
		el=$('#kui-accordion')[0].offsetHeight;
		$(this).next(".acc-content").slideToggle('fast').siblings(".acc-content").slideUp("fast");
		 $(this).toggleClass("active");
		 $(this).siblings("h3").removeClass("active");
		//$('#kui-accordion').css('height', el);
	});
}

function autoFill(id, v){
	$(id).css({ color: "#284f88" }).attr({ value: v }).focus(function(){
		if($(this).val()==v){
			$(this).val("").css({ color: "#284f88" });
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).css({ color: "#284f88" }).val(v);
		}
	});
}

function backtoTop() {
		var userAgent = navigator.userAgent.toLowerCase();
		$.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());
		if($.browser.opera){
			var elmT=$('html');
		}
		else {
			var elmT=$('html, body');
		}	
		$('.back-to-top').click(function(){
			elmT.animate({ scrollTop: 0 }, 500);// for back to top scroll
			return false;
		});
}

function printPage() {
	$('.print').click(function(){
		window.print();
	});
}
