function renewCode(){
	var myRandom = parseInt(Math.random()*99999999);
	$('#c_security_img').attr( 'src', '../random.php?what=contact&renew=true&rand=' + myRandom );	
}

function ValidateContact(){
	var fl = "";
	var bull = "<br />\n&nbsp;&bull;&nbsp;";
	var validRegExp;
    var strEmail;
	
	if ($('#c_name').val() == "" || ($('#c_name').val() == 'Name')) {		
		fl = fl + bull + "Name\n";
    }
	if ($('#c_email').val() == "" || ($('#c_email').val() == 'Email Address')) {
        fl = fl + bull + "Email Address\n";
    }
	validRegExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/i;
    strEmail = $('#c_email').val();
	if ($('#c_email').value != "") {
        if (strEmail.search(validRegExp) == -1) {
            fl = fl + bull +"Invalid Email Adress\n";
        }
    }
	if ($('#c_number').val() == "" || ($('#c_number').val() == 'Mobile Number')) {		
		fl = fl + bull + "Mobile Number\n";
    }	
	if ($('#contact-list-sel').val()== '') {
		fl = fl + bull + "Choose Network\n";
    }	
	if ($('#c_comment').val() == "" || ($('#c_comment').val() == 'Comment')) {		
		fl = fl + bull + "Comment\n";
    }
	if ($('#c_security_code').val() == "" || ($('#c_security_code').val() == 'Enter security code')) {		
		fl = fl + bull + "Security code\n";
    }		
	
	if (fl == ""){		
        return ( true );
    } else {
        $('#idErrorC').html("The following fields are required:\n\n" + fl);
        return( false );
    }
}

(function ($) {
  $.fn.fadeTransition = function(options) {
    var options = $.extend({pauseTime: 5000, transitionTime: 2000}, options);

    Trans = function(obj) {
      var timer = null;
      var current = 0;
      var els = $("> *", obj).css("display", "none").css("left", "0").css("top", "0").css("position", "absolute");
      $(obj).css("position", "relative");
      $(els[current]).css("display", "block");

      function transition() {
        var next = (current + 1) % els.length | 0;
        $(els[current]).fadeOut(options.transitionTime);
        $(els[next]).fadeIn(options.transitionTime);
        current = next;
        cue();
      };

      function cue() {
        if ($("> *", obj).length < 2) return false;
        if (timer) clearTimeout(timer);
        timer = setTimeout(transition, options.pauseTime);
      };

      cue();
    };

    return this.each(function() {
      var t = new Trans(this);
    });
  }
})(jQuery);

$(document).ready(function() {
	$('#book_now ul').fadeTransition({pauseTime: 5000, transitionTime: 2000});
	$('#contact-list-sel').sSelect({ddMaxHeight: '168px'});
});