$(document).ready(function() {


	$('.navMncontent').css({'padding-top' : '4px'}).append("<ul><li><a href='index.php'>HOME</a></li><li><a href='http://www.smayo.myadrhomes.com/'>SEARCH PROPERTIES</a></li><li><a href='scguide.php'>SC GUIDE</a></li><li><a href='http://adt.rereport.com'>MARKET STATS</a></li><li><a href='buyer.php'>BUYERS</a></li><li><a href='seller.php'>SELLERS</a></li><li><a href='blog.php'>BLOG</a></li><li><a href='testimonials.php'>TESTIMONIALS</a></li><li><a href='aboutme.php'>ABOUT ME</a></li><li><a href='contact.php'>CONTACT ME</a></li></ul>");
	$('.navMncontent li').css({'display' : 'inline', 'margin-left' : '15px'});
	$('.navMncontent a').css({'font-size' : '14px', 'color' : '#626469', 'text-decoration' : 'none'});
	$('.navMncontent a').hover(function () {$(this).css({'text-decoration' : 'underline', 'color' : '#336699'});},	function() {$(this).css({'text-decoration' : 'none', 'color' : '#626469'});});
	$('.ftrMncontent').corner('bottom cc:#575a5d');
	$('.barRt').corner('');
	$('.navMntopborder').corner('top cc:#575a5d');
	
	$('.name').focus().blur(function() {
		var name = $(this);
		
		if(name.val().length > 0 && name.val().length < 2 ) {
			name.removeClass().addClass('errorbox').prev().children().hide().html('<img src=\"images/infoiconorange.png\" />  Minimum 2 characters.').fadeIn();
			return false;
			}
		else if(name.val().length == ''){
			name.removeClass().prev().children().hide().html('<img src="images/infoicon.png" /> Optional, if you enter a name must be between 2 and 13 characters.').fadeIn();
			return true;
			}
		else{
			name.removeClass().addClass('validated').prev().children().hide().html('<img src=\"images/validateicongreen.png\" />  Thank You.').fadeIn();
			return true;
		}
	});
	
	$('.email').blur(function() {
	
	var email = $(this);
	var a = $(this).val();
	var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;
		if(filter.test(a)) {
			email.removeClass().addClass('validated').prev().children().hide().html('<img src=\"images/validateicongreen.png\" /> 	Thank You.').fadeIn();
			return true;			
			} 
		else if(email.val().length == ''){
			email.removeClass().prev().children().hide().html('<img src="images/infoicon.png" /> Optional, if you enter an email must be in correct format.').fadeIn();
			return true;
			}
		else{
			email.removeClass().addClass('errorbox').prev().children().hide().html('<img src=\"images/infoiconorange.png\" />  Must be in email format.').fadeIn();
			return false;
			}
	});

	$('.comment').blur(function() {
	
	var comment = $(this);

		if(comment.val().length < 4){
			comment.removeClass().addClass('errorbox').prev().children().hide().html('<img src=\"images/infoiconorange.png\" />  Minimum 4 characters.').fadeIn();
			return false;
		}
		else{
			comment.removeClass().addClass('validated').prev().children().hide().html('<img src=\"images/validateicongreen.png\" />  Thank You.').fadeIn();
			return true;
		}
	});
			
	$('.reply').blur(function() {
		
		var reply = $(this);

			if(reply.val().length < 4){
				reply.removeClass().addClass('errorbox').prev().children().hide().html('<img src=\"images/infoiconorange.png\" />  Minimum 4 characters.').fadeIn();
				return false;
			}
			else{
				reply.removeClass().addClass('validated').prev().children().hide().html('<img src=\"images/validateicongreen.png\" />  Thank You.').fadeIn();
				return true;
			}
		});
	
});

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});
