$(document).ready(function(){

    $("ul").each(function() {
        $(this).children("li:first").addClass('li_first');
        $(this).children("li:last").addClass('li_last');
        $(this).children("li:even").addClass('li_even');
        $(this).children("li:odd").addClass('li_odd');
    });
	
	try {
		$('input.inputclear').inputclear();		
	} catch(e) {
		//console.log(e.description);
	}	
	
	/*
	try {
		$('.home_feature .feature_drawer_slides').jcarousel({
			buttonPrevHTML: '<a href="#up" title="Scroll Up">Scroll Up</a>',
			buttonNextHTML: '<a href="#down" title="Scroll Down">Scroll Down</a>',
			vertical: true,
			wrap: 'circular',
			scroll: 1,
			animation: 'fast',
			easing: 'swing',
			start: $(this).find('li').length/2,
			initCallback: function(c, s) {
	
				c.list.css('marginLeft',c.list.width() + 10);
			}
		});
	} catch(e) {
		//console.log(e.description);
	}
	*/
	
	/* Locations map rollovers */
	function toggleState(state) {
		var newVis = ($('.locations_map_holder').find('.location.'+state).css('visibility') != 'hidden') ? "hidden":"visible";			
		$('.locations_map_holder').find('.location.'+state).css('visibility', newVis);
	}
	
	try {
		$('.locations_map area')
			.mouseover(function() {toggleState($(this).attr('class'))})
			.mouseout(function() {toggleState($(this).attr('class'))});
	} catch(e) {}
	
	try {
    	$('.home_feature').drawerslider();
	} catch(e) {}
	/*
	
	try {
	
		var paper = Raphael('drawer_close', 33, 33);
		
		var c_out = paper.circle(16, 16, 16).attr({
			fill: "#fff",
			stroke: "none"
		});
		var c_in  = paper.circle(16, 16, 9).attr({
			fill: "#eeb211",
			stroke: "none"
		});
		
		var a  = paper.image('/_images/drawer_arrow.png', 12.5, 12.5, 6, 8);	
		
		$('a[href*="drawer"]')
			.toggle(
				// Sliding in
				function() {
					// Move the slides
					$('.feature_drawer_slides').animate({
						marginLeft: '0'
					}, 200, 'swing');
					
					// Move the navigation buttons
					$('a[href*="up"], a[href*="down"]').show().animate({
						left: '50%'
					}, 200, 'swing', function() {
						$('a[href*="up"]').animate({
							top: '4px'
						}, 200, 'swing');
						$('a[href*="down"]').animate({
							bottom: '4px'
						}, 200, 'swing');
					});
	
					// Move the drawer opener button
					$(this).animate({
						left: '1'
					}, 200, 'swing', function() {
						c_out.attr({fill:"#a46317"});
					});
					
					// Rotate the drawer opener button
					a.animate({rotation: 180, isAbsolute: true, x: 14}, 200, ">");
					c_out.animate({fill: "#a46317"}, 200, ">");
					
					return false;
				},
				// Sliding out
				function() {	
					// Move the slides, then hide the navigation buttons when done			
					$('.feature_drawer_slides').animate({
						marginLeft: $('.feature_drawer_slides').width() + 10
					}, 200, 'swing');
					
					// Move the navigation buttons
					$('a[href*="up"], a[href*="down"]').animate({
							left: '150%'
					}, 200, 'swing', function() {
						$(this).hide();
					});
					$('a[href*="up"]').animate({
						top: '20px'
					}, 200, 'swing');
					$('a[href*="down"]').animate({
						bottom: '20px'
					}, 200, 'swing');
					
					// Move the drawer opener button
					$(this).animate({
						left: $('.feature_drawer_slides').outerWidth() +1 
					}, 200, 'swing', function() {
						c_out.attr({fill:"#fff"});
					});
					
					// Rotate the drawer opener button
					a.animate({rotation: 0, isAbsolute: true, x: 12.5}, 200, ">");
					c_out.animate({fill: "#fff"}, 200, ">");
					
					return false;
				}		
			)
			.mouseover(function() {
				// > 1 : Drawer is closed
				if ( parseInt($(this).css('left')) > 1 ) {
					c_out.attr({fill:"#a46317"});
				} else {
					c_out.attr({fill:"#fff"});
				}			
			})
			.mouseout(function() {
				// > 1 : Drawer is closed
				if ( parseInt($(this).css('left')) > 1 ) {
					c_out.attr({fill:"#fff"});
				} else {
					c_out.attr({fill:"#a46317"});
				}			
			})
			
	} catch(e) {}
	
	*/
});


function openBrWindow(url, wname, attr) {
	window.open(url, wname, attr);
}


