/*$(document).ready(function(){ - can't use this - may cause conflicts */
/*jQuery.noConflict();  - can't use this - it messes up later calls to jQuery*/

/* Need to do this so there is no conflict with jQuery - needed for blogs, ATP site and possibly others */
jQuery(document).ready(function(){

	//get the element object of search text field
	var e = jQuery("input[id='mast']");
	var sa = jQuery("input[name='mast-btn']");
	var btn = false;
	if(sa.length > 0){
		btn = true;
	} else {
		sa = jQuery('.sa');
	}
	var s = "Search";
	//initilize the search text field
	e.val(s);
	jQuery('#esri_searchbox input').addClass('init_css');
	//bind the onblur event to the function
	e.bind('blur', function(){
    	if(jQuery.trim(jQuery(this).val()) == ""){
			jQuery(this).val(s);
			jQuery(this).addClass('init_css');
		} 
	});
	//bind the onfocus event to the function
	e.bind('focus', function(){
    	if(jQuery.trim(jQuery(this).val()) == s){
			jQuery(this).val("");
			jQuery(this).removeClass('init_css');
		} 
	});
	sa.bind('click', function(){
		if(e.val() == s ){
			return false;
		} 
		else {
			jQuery('#esri_searchbox').submit();
		}
	});
});



