$(document).ready(function()   {
$('#slider').hide();
/*$("#content-ajax").load('cmc-left-menu.php');
$(window).scroll(function () {
            if ($(this).scrollTop() > 50) {
$("#content-ajax").load('job-oriented-courses-remote-page.php');   
            }
            else
            $("#content-ajax").load('cmc-left-menu.php'); 
            });
$(".nav li a").click(function(){
var page=$(this).attr('href');
//alert(page+'.php');
$("#content-ajax").load(page+'.php');
return false;
});

*/    

$("#back-top").hide();
    $("#reset-password").click(function(){
    $("#reset-password-div").animate({height:125},"500");
    }); 
    $("#cancel-reset").click(function(){
    $("#reset-password-div").animate({height:1},"500");
    $(".login-error, .register").hide();
    });
    $("#recover-div").click(function(){
    $("#forgot-div").animate({height:80},"500");
    $("#loginemail").hide();
    $("#password").hide();
    $("#login").hide();
    $("#login-slide-div").animate({height:1},"500");
    $("#forgot-txt-box").focus();
    }); 
    $("#forgot-cancel").click(function(){
    $("#forgot-div").animate({height:1},"500");
    $("#loginemail").show();
    $("#password").show();
    $("#login").show();
    $(".login-error, .register").hide();
    $("#login-slide-div").animate({height:28},"500");
    }); 
			$("#slider").easySlider({
				auto: true,
				continuous: true 
			});
    // fade in #back-top
    $(function () {
        $(window).scroll(function () {
            if ($(this).scrollTop() > 450) {
                $('#back-top').fadeIn();
            } else {
                $('#back-top').fadeOut();
            }
        });

        // scroll body to 0px on click
        $('#back-top a').click(function () {
            $('body,html').animate({ scrollTop: 0 }, 500);
            return false;
        });
		});
   /* jQquery.fn.myfun=function(){
    
    };
    $('#courses,#footer-courses').click(function(){
    
    $('body,html').animate({ scrollTop: 525 + $('#main-comment').height()+$('#reset-password-div').height() }, 500);
            return false;
    });*/
        $('#signup-forum-div').click(function(){
    
    $('body,html').animate({ scrollTop: 380 + $('#reset-password-div').height() }, 900);
        $("#fname").css("border", "2px solid #339900");
            return false;
    });

    $('#signup-div').click(function(){
    $('body,html').animate({ scrollTop: 315 + $('#reset-password-div').height() }, 500);
    $("#fname").css("border", "2px solid #339900");
            return false;
    });
    $('.nav-left a').mouseover(function(){
    $(this).animate({paddingLeft:20},300);
    });
    $('.nav a').mouseover(function(){
    $(this).animate({paddingLeft:40},300);
    });
    $('.nav a,.nav-left a').mouseout(function(){
    $(this).stop();
    $(this).animate({paddingLeft:4},300);
    });

});
function hideText(txt) {
    if (txt.value == txt.defaultValue) {
        txt.value = '';
        
    }  txt.style.color = '#000';
}
function showText(txt) {
    if (txt.value == '') {
        txt.value = txt.defaultValue;
        txt.style.color = '#999999';
    }
    txt.style.borderWidth="1px";
    txt.style.borderColor="#666666";
    }
    
    
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}
	
	/* Phone validation */
var digits = "0123456789";
var phoneNumberDelimiters = "()- ";
var validWorldPhoneChars = phoneNumberDelimiters + "+";
var minDigitsInIPhoneNumber = 10;
function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true;
}
function trim(s)
{   var i;
    var returnString = "";
     for (i = 0; i < s.length; i++)
    {   
    
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
var bracket=3
strPhone=trim(strPhone)
if(strPhone.indexOf("+")>1) return false
if(strPhone.indexOf("-")!=-1)bracket=bracket+1
if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
var brchr=strPhone.indexOf("(")
if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}    

    function validate(){
    if(document.getElementById('fname').value=="Full Name")
	{
		alert("Please enter your full name");
    document.getElementById('fname').style.borderWidth="2px";
    document.getElementById('fname').style.borderColor="red";
		document.getElementById('fname').focus();
		return false;
	}
  
	if(document.getElementById('add').value=="Address")
	{
		alert("Please Enter your Address");
    document.getElementById('add').style.borderWidth="2px";
    document.getElementById('add').style.borderColor="red";
		document.getElementById('add').focus();
		return false;
	}
  
  if(trim(document.getElementById('mobile').value)=="")
	{
		alert("Please enter your mobile number");
		document.getElementById('mobile').focus();
		return false;
	}
	if (checkInternationalPhone(document.getElementById('mobile').value)==false)
	{
	    alert("Please Enter a Valid Mobile Number");
		document.getElementById('mobile').value="Mobile No.";
    document.getElementById('mobile').style.borderWidth="2px";
    document.getElementById('mobile').style.borderColor="red";
		document.getElementById('mobile').focus();
		return false
	}
  
    if (document.getElementById('email').value=="Email")
	{
		alert("Please Enter your Email Address") ;
    document.getElementById('email').style.borderWidth="2px";
    document.getElementById('email').style.borderColor="red";
		document.getElementById('email').focus();
		return false
	}
	if (echeck(document.getElementById('email').value)==false)
	{
		document.getElementById('email').value="Email";
    document.getElementById('email').style.borderWidth="2px";
    document.getElementById('email').style.borderColor="red";
		document.getElementById('email').focus();
		return false
	}
  
    if(document.getElementById('course').value=="Course/Training?")
	{
		alert("Please select the Course/Training you are interested in.");
    document.getElementById('course').style.borderWidth="2px";
    document.getElementById('course').style.borderColor="red";
		document.getElementById('course').focus();
		return false;
	}
   if(document.getElementById('other').style.visibility=="visible")
   {
   if(document.getElementById('other').value=="Specify Other..")
	{
		alert("Please Specify the Other Course / Training that you are interested in.");
    document.getElementById('other').style.borderWidth="2px";
    document.getElementById('other').style.borderColor="red";
		document.getElementById('other').focus();
		return false;
	}
  }
  if(document.getElementById('college').value=="College Name")
	{
		alert("Please Enter Your College name");
    document.getElementById('college').style.borderWidth="2px";
    document.getElementById('college').style.borderColor="red";
		document.getElementById('college').focus();
		return false;
	}

    }
    
  function validatequery(){  
    if(document.getElementById('query-fname').value=="Full Name")
	{
		alert("Please enter your full name");
    document.getElementById('query-fname').style.borderWidth="2px";
    document.getElementById('query-fname').style.borderColor="red";
		document.getElementById('query-fname').focus();
		return false;
	}
  if(document.getElementById('query-add').value=="Enter your Query..")
	{
		alert("Please Enter your Query");
    document.getElementById('query-add').style.borderWidth="2px";
    document.getElementById('query-add').style.borderColor="red";
		document.getElementById('query-add').focus();
		return false;
	}
  if(trim(document.getElementById('query-mobile').value)=="")
	{
		alert("Please enter your mobile number");
		document.getElementById('query-mobile').focus();
		return false;
	}
	if (checkInternationalPhone(document.getElementById('query-mobile').value)==false)
	{
	    alert("Please Enter a Valid Mobile Number");
		document.getElementById('query-mobile').value="Mobile No.";
    document.getElementById('query-mobile').style.borderWidth="2px";
    document.getElementById('query-mobile').style.borderColor="red";
		document.getElementById('query-mobile').focus();
		return false
	}
    if (document.getElementById('query-email').value=="Email")
	{
		alert("Please Enter your Email Address") ;
    document.getElementById('query-email').style.borderWidth="2px";
    document.getElementById('query-email').style.borderColor="red";
		document.getElementById('query-email').focus();
		return false
	}
	if (echeck(document.getElementById('query-email').value)==false)
	{
		document.getElementById('query-email').value="Email";
    document.getElementById('query-email').style.borderWidth="2px";
    document.getElementById('query-email').style.borderColor="red";
		document.getElementById('query-email').focus();
		return false
	}
  }
  function writetestimonial(){
  document.getElementById('tfname').style.borderWidth="2px";
  document.getElementById('tfname').style.borderColor="red";
  document.getElementById('tfname').focus();
  return false;
  }
  function validatetestimonials(){  
    if(document.getElementById('tfname').value=="")
	{
		alert("Please enter your full name");
    document.getElementById('tfname').style.borderWidth="2px";
    document.getElementById('tfname').style.borderColor="red";
		document.getElementById('tfname').focus();
		return false;
	}
  if (document.getElementById('temail').value=="")
	{
		alert("Please Enter your Email Address") ;
    document.getElementById('temail').style.borderWidth="2px";
    document.getElementById('temail').style.borderColor="red";
		document.getElementById('temail').focus();
		return false
	}
	if (echeck(document.getElementById('temail').value)==false)
	{
		document.getElementById('temail').value="";
    document.getElementById('temail').style.borderWidth="2px";
    document.getElementById('temail').style.borderColor="red";
		document.getElementById('temail').focus();
		return false
	}
  if(document.getElementById('tcollege').value=="")
	{
		alert("Please Enter Your College Name");
    document.getElementById('tcollege').style.borderWidth="2px";
    document.getElementById('tcollege').style.borderColor="red";
		document.getElementById('tcollege').focus();
		return false;
	}
  if(document.getElementById('tccity').value=="")
	{
		alert("Please Enter Your College City");
    document.getElementById('tccity').style.borderWidth="2px";
    document.getElementById('tccity').style.borderColor="red";
		document.getElementById('tccity').focus();
		return false;
	}
  if(document.getElementById('ttesti').value=="")
	{
		alert("Please Enter Something");
    document.getElementById('ttesti').style.borderWidth="2px";
    document.getElementById('ttesti').style.borderColor="red";
		document.getElementById('ttesti').focus();
		return false;
	}
  }
  
$(document).ready(function(){
$('#slider').show();		
});

