$(document).ready(function(){
    
    $('#sawmenu').find('> li').hover(function(){
		$(this).children('a').toggleClass('hovered');
		$(this).find('ul').stop(true, true).toggle(0);
	});
    
    $('#carousel').cycle({ 
        fx      :   'fade', 
        speed   :   800, 
        timeout :   5000, 
        next    :   '#cnext', 
        prev    :   '#cprev' 
    });
    
    $('.saw_gallery_list .attachment-thumbnail').parent('a').lightBox();
	$('.section_sidebox .attachment-thumbnail').parent('a').lightBox();
	
    
    $('input[type=text], input[type=password], textarea').each(function(){			
	    var d_value = this.value;			    
	    $(this).focus(function(){
	        if(this.value == d_value){
	            this.value = '';
	        }
	    });	
				    
	    $(this).blur(function(){
	    	if(this.value == ''){
	            this.value = d_value;
	        }
	    });		    
	});
    
    if ($.browser.msie && $.browser.version == 6){
		$('#sawsubnav').css('width', $(window).width());
	}
	
});



    

    
    
    
    
    

function addEvent(obj, evType, fn){ 
	if (obj.addEventListener){ 
		obj.addEventListener(evType, fn, true); 
		return true; 
	}else if (obj.attachEvent){ 
		var r = obj.attachEvent("on"+evType, fn); 
		return r; 
	}else{ 
		return false; 
	} 
}

function hideFocusBorders(){
var theahrefs = document.getElementsByTagName("a");
	if (!theahrefs){return;}
		for(var x=0;x!=theahrefs.length;x++){
		theahrefs[x].onfocus = function stopLinkFocus(){this.hideFocus=true;};
	}
}

addEvent(window, 'load', hideFocusBorders);
