/*
 * label2value
 * jquery based script for using form labels as text field values
 * more info on http://cssglobe.com/post/1500/using-labels- 
 *
 * Copyright (c) 2008 Alen Grakalic (cssglobe.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 */

this.label2value = function(){	

	// CSS class names
	// put any class name you want
	// define this in external css (example provided)
	var inactive = "inactive";
	var active = "active";
	var focused = "focused";
	
	// function
	$("label").each(function(){		
		obj = document.getElementById($(this).attr("for"));
		if(($(obj).attr("type") == "text") || (obj.tagName.toLowerCase() == "textarea")){			
			$(obj).addClass(inactive);			
			var text = $(this).text();
			$(this).css("display","none");			
			$(obj).val(text);
			$(obj).focus(function(){	
				$(this).addClass(focused);
				$(this).removeClass(inactive);
				$(this).removeClass(active);								  
				if($(this).val() == text) $(this).val("");
			});	
			$(obj).blur(function(){	
				$(this).removeClass(focused);													 
				if($(this).val() == "") {
					$(this).val(text);
					$(this).addClass(inactive);
				} else {
					$(this).addClass(active);		
				};				
			});				
		};	
	});		
};
// on load
$(document).ready(function(){	
	label2value();	
});

//DROP DOWN MENU

var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function topNav_open()
{  topNav_canceltimer();
   topNav_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function topNav_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function topNav_timer()
{  closetimer = window.setTimeout(topNav_close, timeout);}

function topNav_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#topNav > li ').bind('mouseover', topNav_open)
   $('#topNav > li ').bind('mouseout',  topNav_timer)
   $(".clickable").click(function(){
     window.location=$(this).find("a").attr("href");
     return false;
});
   });

document.onclick = topNav_close;



/*
/////////////////////
Font = {
// check if font is available with jQuery Plug-In
available: $.fontAvailable('Calibri'),

// flag to tell if the font is already loaded
// remember that the font if it's IE then the Cufon library
// has already been loaded.
// Also check with the jQuery Plug-In just in case.
loaded: $.browser.msie || $.fontAvailable('Calibri') || false,

load: function(callback) {
$.getScript('js/lib/cufon/font.min.js', function() {
Font.loaded = true;
callback();
});
},

place: function(elem) {
// If font is already loaded via @font-face or installed
// on the computer, then no further work is needed
if (Font.available)
return;

function _place() {
if (typeof elem === 'string')
Cufon.replace(elem);
else
for (var i = 0; i < elem.length; i++) {
Cufon.replace(elem);
}

Cufon.refresh();
}

if (!Font.loaded) Font.load(_place);


else _place();
},

refresh: function() {
// If font is already loaded via @font-face or installed
// on the computer, then no further work is needed
if (Font.available)
return;

Cufon.refresh();
}
};

// Usage Example

// Hook up Cufon if font is not available
Font.place('h1');

// Replace the content of the element
$('h1').eq(0).text('A New Header Text');

// Refresh the font replacements if font is not available
Font.refresh();

*/