var div_id = 'pg_cnt';
function check_username(formname, field, msg, checking, mode)
{
	//alert("field");

    var frm = eval("document."+formname+"."+field+".value");
    //alert(frm);
    if(frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        //document.getElementById("title_name")focus();
        $("#"+field).after('<br/><label id="label_'+field+'" class="error" style="color:red;display:inline; align=center">'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
		
        return false;
    }
    else
    {
        document.getElementById("btn_create").disabled = false;
		
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
    }
}

function check_date(formname, field, msg, checking, mode)
{

    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        
        $("#"+field).after('<br><label id="label_'+field+'" class="error" style="color:red;display:inline;align=center">'+msg+'</label><br>');
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        document.getElementById("btn_create").disabled = false;
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
    }
}

function check_batch(formname, field, msg, checking, mode)
{

    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        
        $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        document.getElementById("btn_create").disabled = false;
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
    }
}

/*********limitChar**********/
/*function limitChars(name,limit, div)
{
 
}*/

function check_course(formname, field, msg, checking, mode)
{
    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        
        $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        document.getElementById("btn_create").disabled = false;
        
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
    }
}
function check_address(formname, field, msg, checking, mode)
{

    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        
        $("#"+field).after('<br/><label id="label_'+field+'" class="error" style="color:red;display:inline;padding:0px 0px 0px 125px;">'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        document.getElementById("btn_create").disabled = false;
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
    }
}
function check_invit(formname, field, msg, checking, mode)
{

    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        
        $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
      
        return false;
    }
    else
    {
             if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
    }
}
function check_login(formname, field, msg, checking, mode)
{
    var frm = eval("document."+formname+"."+field+".value");
    //alert(frm);
    if (frm == "")
    {
        /*if($("#label_"+field)) {
            $("#label_"+field).remove();
        }*/
        if(document.getElementById("label_login_id").style.display=="inline") {
        
            document.getElementById("label_login_id").style.display="none";
        }
 
        if(document.getElementById("label_logincheck").style.display=="inline") {
        
            document.getElementById("label_logincheck").style.display="none";
        }
        /*$("#"+field).after('<br/>'+'<label id="label_'+field+'" class="error" style="color:red;display:inline;">'+msg+'</label>');*/
        document.getElementById("label_login_id").style.display="inline";
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        $.ajax({
            type: "GET",
            url: "../includes/process.php",
            data: {
                type : "check_loginid",
                login_id: document.form1.login_id.value
            },
            success: function(msg) { //alert(msg);
                if(msg == 'false') {

                    if(document.getElementById("label_login_id").style.display=="inline")
                    {
                        document.getElementById("label_login_id").style.display="none";
                    }

                    document.getElementById("label_logincheck").style.display = "inline";
                    
                    document.getElementById("btn_create").disabled = true;
                    return false;
                }
                else
                { //alert("Test "+msg);
                    document.getElementById("btn_create").disabled = false;
                    /*if($("#label_"+field)) {
                        $("#label_"+field).remove();
                    }*/
                    if(document.getElementById("label_login_id").style.display=="inline") {

                        document.getElementById("label_login_id").style.display="none";
                    }

	if(document.form1.login_id.value!=""){ //alert("valid");
	   var reg = /^([A-Za-z0-9_\-])+([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   var address = document.form1.login_id.value;
	   if(reg.test(address) == false) 
		{
		 alert("Please enter a valid E-mail")
			 document.form1.login_id.focus();
			  return false
		}
	}

                    if(document.getElementById("label_logincheck").style.display=="inline") {

                        document.getElementById("label_logincheck").style.display="none";
                    }
                }
            }
        });    
    }
}
/*Included 21.04.2011*/
function check_relogin(formname, field, msg, checking, mode)
{ //alert("relogin");
    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        /*if($("#label_"+field)) {
            $("#label_"+field).remove();
        }*/
        if(document.getElementById("label_re_login_id").style.display=="inline") {
        
            document.getElementById("label_re_login_id").style.display="none";
        }
        if(document.getElementById("label_relogincheck").style.display=="inline") {
        
            document.getElementById("label_relogincheck").style.display="none";
        }
        /*$("#"+field).after('<br/>'+'<label id="label_'+field+'" class="error" style="color:red;display:inline;">'+msg+'</label>');*/
        document.getElementById("label_re_login_id").style.display="inline";
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        $.ajax({
            type: "GET",
            url: "../includes/process.php",
            data: {
                type : "check_reloginid",
                login_id: document.form1.re_login_id.value
            },
            success: function(msg) {
                if(msg == 'false') {

                    if(document.getElementById("label_re_login_id").style.display=="inline")
                    {
                        document.getElementById("label_re_login_id").style.display="none";
                    }

                    document.getElementById("label_relogincheck").style.display = "inline";
                    
                    document.getElementById("btn_create").disabled = true;
                    return false;
                }
                else
                { //alert(frm);
                    document.getElementById("btn_create").disabled = false;
                    /*if($("#label_"+field)) {
                        $("#label_"+field).remove();
                    }*/
		
			if(document.form1.re_login_id.value!=""){
				if(document.form1.re_login_id.value!=document.form1.login_id.value){
					alert("Login Id and Re - enter Login Id must be same");
				}
			}

                    if(document.getElementById("label_re_login_id").style.display=="inline") {

                        document.getElementById("label_re_login_id").style.display="none";
                    }
                    if(document.getElementById("label_relogincheck").style.display=="inline") {

                        document.getElementById("label_relogincheck").style.display="none";
                    }
                }
            }
        });    
    }
}
/*Included 21.04.2011*/
function check_pwd(formname, field, msg, checking, mode)
{

    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        
        $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        if (frm.length < 5)
        {
            if($("#label_"+field)) {
                $("#label_"+field).remove();
            }        
            $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>Your password must be at least 5 characters long</label>');
            document.getElementById("btn_create").disabled = true;
            return false;
        }
        else
        {
            document.getElementById("btn_create").disabled = false;
            if($("#label_"+field)) {
                $("#label_"+field).remove();
            }
        }
    }
}

function check_cpwd(formname, field, msg, checking, mode)
{

    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        
        $("#"+field).after('<br/>'+'<label id="label_'+field+'" class="error" style="color:red;display:inline;">'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        if (document.form1.password.value != frm)
        {
            if($("#label_"+field)) {
                $("#label_"+field).remove();
            }
        
            $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>Please enter the same password as above</label>');
            document.getElementById("btn_create").disabled = true;
            return false;
        }
        else
        {
            document.getElementById("btn_create").disabled = false;
            if($("#label_"+field)) {
                $("#label_"+field).remove();
            }
        }
    }
}
function check_captcha(formname, field, msg, checking, mode)
{

    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }

        if(document.getElementById("label_captchacheck").style.display=="inline") {
        
            document.getElementById("label_captchacheck").style.display="none";
        }
        $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        $.ajax({
            type: "GET",
            url: "chk-captcha.php",
            data: {
                type : "check_captcha",
                captcha: document.form1.captcha.value
            },
            success: function(msg) {
                if(msg == 'false') {
    
                    if($("#label_"+field)) {
                        $("#label_"+field).remove();
                    }
                    document.getElementById("label_captchacheck").style.display = "inline";
                    
                    document.getElementById("btn_create").disabled = true;
                    return false;
                }
                else
                {
                    document.getElementById("btn_create").disabled = false;
                    if($("#label_"+field)) {
                        $("#label_"+field).remove();
                    }
                    if(document.getElementById("label_captchacheck").style.display=="inline") {

                        document.getElementById("label_captchacheck").style.display="none";
                    }                    
                }
            }
        });    
    }
}


function check_registration()
{
    var name = check_username('form1','user_name', 'Please enter the Name', 0, '')
    if(document.getElementById("batch_div").style.display != "none" && document.getElementById("course_div").style.display != "none") {

        var batch = check_batch('form1','batch', 'Please select the Batch', 0, '');
        var course = check_course('form1','course', 'Please select the Course', 0, '');
    } 
    else
    {
        var batch = true;
        var course = true;
    }
    var address = check_address('form1','address', 'Please enter the Permanent Address', 0, '');
    var login = check_login('form1','login_id', 'Please enter the Login Id', 1, 'check_loginid');   
	var relogin = check_relogin('form1','re_login_id', 'Please fill Re - enter Login Id', 1, 'check_reloginid');  
    var password = check_pwd('form1','password', 'Please provide a password', 0, '');    
    var cpassword = check_cpwd('form1','cpassword', 'Please provide a password', 0, '');    
    var captcha = check_captcha('form1','captcha', 'Please answer this simple calculation', 1, 'check_captcha');  

    if(name == false || batch == false || course == false || address == false || login == false || relogin == false || password || false  || cpassword || false || captcha || false)
    {   
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        document.form1.submit();
        return true;
    }
}
function validate_multi(form,val)
    {
        var flag = 0;

        var multiselect = eval("document."+form+".elements[val]");
		
		for(var i=0;i<multiselect.length;i++)
        {
           if(multiselect[i].selected == true)
           {
                flag = 1;
                break;
           } 
		  
      }
	 return flag;
	}    
    
  

function validate()
{
	//alert("test");
	//tlist2.update();
	//alert($F('facebook-demo'));
	//return false;
	var frm = document.massmail;

    var name = check_username('massmail','subject', 'Please enter  Subject', 0, '');

	
    var content = check_address('massmail','content','Please enter Content',0, '');
	
	var batch_val=validate_multi("massmail","batch_array[]");
	var course_val=validate_multi("massmail","course_array[]");
	var club_val=validate_multi("massmail","club_array[]");

	if(batch_val == 1 || course_val == 1 || club_val == 1)
	{
		 frm.action="../requires/massmail_process.php";
		 frm.submit();	
	}
	else
	{
		document.getElementById("error_batch").style.display = "inline";	
		return false;
	}



}

/*function check_guestlec()
{
	var frm = document.add_lec;

    var name = check_username('add_lec','title_name', 'Please enter the Titleeeeee', 0, '');
    var venue = check_address('add_lec','venue','Please enter Venue',0, '');
	var date =check_date('add_lec','start_date', 'Please enter Date',0, '');
	if(frm.contact_email.value == "")
	{
		var contact_email=check_username('add_lec','contact_email', 'Please enter Contact E-mail', 0, '');
	}
	else
	{
		var contact_email=validate_email('add_lec','contact_email', 'Please enter valid E-mail', 0, '');
	}
	var lecture_name=check_username('add_lec','lecture_name', 'Please enter the Lecturer Name', 0, '');
	
	if(frm.reg_closedate.value == "")
	{
	 var reg_closedate=check_date('add_lec','reg_closedate', 'Please enter Reg.close Date', 0, '');
	}   
	

	if(frm.notes_file.value!="")
	{
			 var notes_file = validate_file('add_lec','notes_file', 'Please Upload Pdf or Doc files', 0, '');
	}
  	
	if(name == false || lecture_name== false || venue == false || date == false || lecture_name==false || reg_closedate==false || contact_email==false)
    {   
        document.getElementById("btn_create").disabled = true;
        return false;
    }
	
    else
    {
				
    frm.action="process.php";
    frm.submit();
    return false;
    }
}	*/

function validate_date(formname, field, msg, checking, mode)
{
	var frm = document.add_lec;
		
	if(frm.start_date.value <= frm.reg_closedate.value )
	{
		
	   $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
	
	}

}

function validate_email(formname, field, msg, checking, mode)
{
	var frm = document.add_lec;
	if(frm.contact_email.value!='')
	{
		if($("#label_"+field)) {
                $("#label_"+field).remove();
		}
		filter = /^[a-zA-Z0-9\_\-.]+@[a-z0-9_-]+\.[a-z0-9_.]{2,4}$|^[a-zA-Z0-9\_\-.]+@[a-z]+\.[a-z]{2,4}\.[a-z]{2}$/;
		retval=filter.test(frm.contact_email.value);
		if(retval==false)
		{
		$("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
		}

		
	}
   
}
function validate_file(formname, field, msg, checking, mode)
{
var frm = document.add_lec;
				
	 if(frm.notes_file.value!= "")
	  {
		var file =frm.notes_file.value.toLowerCase();
	   var flag=0;
	   var file1 = file.split(".");
	   count1 = file1.length;
	   				   
	  if(file1[count1-1] == "doc" || file1[count1-1] == "pdf")
		   {
		      flag = 1;
		   }

	  if(flag == 0)
	   {
		 
	    $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
	   }
    }	
}
function check_phone()
{
    if((document.form1.phone_country.value != "Country" || document.form1.phone_city.value != "City") && (document.form1.phone_no.value == "Phone No"))
    {
        alert("Please enter the Phone No");
        document.form1.phone_no.focus();
    }
}

function open_scrap()
{
    $("#add_scrap").slideToggle("slow");
}

function check_birthdate()
{
    var reg = eval("document.form1");    
    var day = reg.birth_day.value;
    var month = reg.birth_month.value;    
    var year = reg.birth_year.value;
    
    if(day!=false || month!=false || year!=false)    
    {
        var myMonth = new Array('','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');

        if(day == false)
        {
	    	reg.birth_month.value = false;    
    		reg.birth_year.value = false;
			
            alert('Please select date');
            reg.birth_day.focus();
			
            return false;
        }
		//As updated by tester and confirmed with client alert for asking month is discarded. 28th May, Thursday.
        /*if(month == false)
        {
            alert('please select month');
            reg.birth_month.focus();
            return false;
        }*/
        /*if(year == false)
        {
            alert('please select year');
            reg.birth_year.focus();
            return false;
        }
        if(month < 10)
        {
           var monthValue = reg.birth_month.value;
        }
        else
            var monthValue = reg.birth_month.value;
        
        var myDateStr = year + '-' + month+'['+myMonth[monthValue]+']' + '-' + day;

        var myDate = new Date();

        myDate.setFullYear( year, month-1, day );

        var checkDate = myDate.getMonth()+1;

        if ( checkDate != monthValue )
        {
            $("#birth_date").show();
            reg.birth_day.focus();
            return false;
        }
        else
        {
            $("#birth_date").hide();
        }*/
    }    
}

function removefirstspace(form,field)
{
        //alert("hai");
        //var re = /^(\s+$|^\s|\-+|\.+)/g;
        var re = /^(\s+$|^\s|\-+|\.+|\,+|\/+|\_+)/g;

        var fieldval=eval("document."+form+"."+field+".value");
        //alert(fieldval);
        var splchar = fieldval.match(re);

        if(splchar && !fieldval.match("\n"))
        {

                var trimstr=fieldval.replace(re, "");

                eval("document."+form+"."+field+".value=\""+trimstr+"\"");

                eval("document."+form+"."+field+".focus()");
        }
}
function removefirst_specialchar(form,field)
{
    var re = /^(\$|!|@|#|~|`|%|\*|\^|\+|\=|\[|\]|\}|\{|\<|\>|\:|\;|\'|\"|\||\/|\\|\?|\.|\&)/g;
        var fieldval=eval("document."+form+"."+field+".value");
        var splchar = fieldval.match(re);
    //alert(fieldval);
        if((splchar && !fieldval.match("\n")) || (fieldval.charCodeAt(0)==13))
        {
                var trimstr=fieldval.replace(re, "");
                eval("document."+form+"."+field+".value=\""+trimstr+"\"");
                eval("document."+form+"."+field+".focus()");
        }
}

function removefirst_specialchar_txtarea(form, field)
{
    var re = /^(\$|!|@||~|`|%|\*|\^|\+|\=|\[|\]|\}|\{|\<|\>|\:|\;|\'|\"|\||\/|\\|\?|\.|\&)/g;
        var fieldval=eval("document."+form+"."+field+".value");
        var splchar = fieldval.match(re);
    //alert(fieldval);
        if((splchar && !fieldval.match("\n")) || (fieldval.charCodeAt(0)==13))
        {
                var trimstr=fieldval.replace(re, "");
                eval("document."+form+"."+field+".value=\""+trimstr+"\"");
                /*eval("document."+form+"."+field+".focus()");*/
        }
}

function removefirstspace_textarea(form,field)
{
    //var re = /^(\s+$|^\s|\-+|\.+)/g;
    
        var re = /^(\s+$|^\s|\-+|\.+|\,+|\/+|\_+)/g;
        var fieldval=eval("document."+form+"."+field+".value");
        var splchar = fieldval.match(re);
    //alert(fieldval);
        if((splchar && !fieldval.match("\n")) || (fieldval.charCodeAt(0)==13))
        {
                var trimstr=fieldval.replace(re, "");
                eval("document."+form+"."+field+".value=\""+trimstr+"\"");
                eval("document."+form+"."+field+".focus()");
        }
}

function get_borntoday_users()
{
    fleet_type = "born";
    document.getElementById("btn_allalumni").disabled = true;
    
    if(document.getElementById("btn_mybatch") != null)
    {
        document.getElementById("btn_mybatch").disabled = true;
    }
    document.getElementById("btn_recentupdate").disabled = true;
    document.getElementById("btn_borntoday").disabled = true;
    
    $("#fleet-container").html("<img src=\"images/progressbar.gif\">");    
    $.ajax({
        type: "POST",
        url: "requires/profile_process.php",
        data: {
            type : "get_borntoday_users"
        },
        success: function(msg) {
            $("#fleet-container").html(msg);
			$("#user_details_title").html("<h1>People born today </h1>");   
			
            jQuery('#mycarousel').jcarousel({
                auto: 0,
                wrap: null,
                initCallback: mycarousel_initCallback
            });            
            document.getElementById("btn_allalumni").disabled = false;
            
            if(document.getElementById("btn_mybatch") != null)
            {
                document.getElementById("btn_mybatch").disabled = false;
            }
            document.getElementById("btn_recentupdate").disabled = false;
            document.getElementById("btn_borntoday").disabled = false;    
            fleet_count = $.ajax({url: "requires/process_fleet.php",data: {process:"count", type:fleet_type},async: false}).responseText;
        }
    });     
}

function get_allusers()
{
    fleet_type = "all";
    document.getElementById("btn_allalumni").disabled=true;
    if(document.getElementById("btn_mybatch") != null)
    {
        document.getElementById("btn_mybatch").disabled=true;
    }
    document.getElementById("btn_recentupdate").disabled=true;
    document.getElementById("btn_borntoday").disabled=true;
    
    $("#fleet-container").html("<img src=\"images/progressbar.gif\">");    
    $.ajax({
        type: "POST",
        url: "requires/profile_process.php",
        data: {
            type : "get_allusers"
        },
        success: function(msg) {
			//alert(msg);
            $("#fleet-container").html(msg);   
			$("#user_details_title").html("<h1>All Alumni</h1>");   
            jQuery('#mycarousel').jcarousel({
                auto: 0,
                wrap: null,
                initCallback: mycarousel_initCallback
            });
            document.getElementById("btn_allalumni").disabled=false;
            if(document.getElementById("btn_mybatch") != null)
            {
                document.getElementById("btn_mybatch").disabled=false;
            }
            document.getElementById("btn_recentupdate").disabled=false;
            document.getElementById("btn_borntoday").disabled=false;
            //fleet_count = $.ajax({url: "requires/process_fleet.php",data: {process:"count", type:fleet_type},async: false}).responseText;
        }
    });     
}
function get_recentupdated()
{
    fleet_type = "recent";
    document.getElementById("btn_allalumni").disabled=true;
    if(document.getElementById("btn_mybatch") != null)
    {
        document.getElementById("btn_mybatch").disabled=true;
    }
    document.getElementById("btn_recentupdate").disabled=true;
    document.getElementById("btn_borntoday").disabled=true;
   // /p123/ - FROM URL
    $("#fleet-container").html("<img src=\"images/progressbar.gif\">");    
    $.ajax({
        type: "POST",
        url: "requires/profile_process.php",
        data: {
            type : "get_recentupdated"
        },
        success: function(msg) {
			//alert(msg);
            $("#fleet-container").html(msg); 
			$("#user_details_title").html("<h1>Recently updated</h1>"); 
            jQuery('#mycarousel').jcarousel({
                auto: 0,
                wrap: null,
                initCallback: mycarousel_initCallback
            });   
            document.getElementById("btn_allalumni").disabled=false;
            if(document.getElementById("btn_mybatch") != null)
            {
                document.getElementById("btn_mybatch").disabled=false;
            }
            document.getElementById("btn_recentupdate").disabled=false;
            document.getElementById("btn_borntoday").disabled=false;            
            fleet_count = $.ajax({url: "requires/process_fleet.php",data: {process:"count", type:fleet_type},async: false}).responseText;
        }
    });     
}
function get_mybatch()
{
    fleet_type = "batch";
    document.getElementById("btn_allalumni").disabled=true;
    document.getElementById("btn_mybatch").disabled=true;
    document.getElementById("btn_recentupdate").disabled=true;
    document.getElementById("btn_borntoday").disabled=true;
    
    $("#fleet-container").html("<img src=\"images/progressbar.gif\">");    
    $.ajax({
        type: "POST",
        url: "requires/profile_process.php",
        data: {
            type : "get_mybatch"
        },
        success: function(msg) {
            $("#fleet-container").html(msg); 
			$("#user_details_title").html("<h1>My Batch</h1>"); 
            jQuery('#mycarousel').jcarousel({
                auto: 0,
                wrap: null,
                initCallback: mycarousel_initCallback
            }); 
            document.getElementById("btn_allalumni").disabled=false;
            document.getElementById("btn_mybatch").disabled=false;
            document.getElementById("btn_recentupdate").disabled=false;
            document.getElementById("btn_borntoday").disabled=false;            
            fleet_count = $.ajax({url: "requires/process_fleet.php",data: {process:"count", type:fleet_type},async: false}).responseText;
        }
    });     
}

function navigate(page, mod)
{
    
    if(mod == "clubs")
    {
		
		temp_content = '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';		
		$("#clubslist").html(temp_content);
		
		var str = self.location.toString();
		var lt = (str.indexOf("lt=my")>-1)?"my":"";
		
        $.ajax({
            type: "POST",
            url: "index.php",
            data: {
                type : "get_clubs",
                clubspage : page,
                lt:lt
            },
            success: function(msg) {                
                $("#clubslist").html(msg);
            }
        }); 
    }
    else if(mod == "clubs")
    {
		
		temp_content = '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';		
		$("#clubslist").html(temp_content);
		
		var str = self.location.toString();
		var lt = (str.indexOf("lt=my")>-1)?"my":"";
		
        $.ajax({
            type: "POST",
            url: "index.php",
            data: {
                type : "get_clubs",
                clubspage : page,
                lt:lt
            },
            success: function(msg) {                
                $("#clubslist").html(msg);
            }
        }); 
    }
    else if(mod == "event")
    {
	
			
			//temp_content = '<div class="clr1"></div>';<div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';
			temp_content = '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';		
			$("#eventlist").html(temp_content);
	        if(document.form1.Event_Type1.checked == true)
			Event_Type1 = 1;
			else
			Event_Type1 = "";
			if(document.form1.Event_Type2.checked == true)
			Event_Type2 = 2;
			else
			Event_Type2 = "";
			if(document.form1.Event_Type3.checked == true)
			Event_Type3 = 3;
			else
			Event_Type3 = "";
	
			if(document.form1.club_event.checked == true)
			club_eventa = 4;
			else
			club_eventa = "";
	
			 var con = document.form1.country.selectedIndex;
			 var country = document.form1.country.options[con].value;
			 if(country != "")
			 country_sel = country;
		     else
		     country_sel = "";
	
			 var sta = document.form1.state.selectedIndex;
			 var state_ss = document.form1.state.options[sta].value;
			 if(state_ss != "")
			 state_ss_event = state_ss;
		     else
		     state_ss_event = "";
	
			 var cit = document.form1.city.selectedIndex;
			 var city = document.form1.city.options[cit].value;
			 if(city != "")
			 city_event = city;
		     else
		     city_event = "";
	
			 var Interval_event = document.form1.Select_interval.selectedIndex;
			 var intervel = document.form1.Select_interval.options[Interval_event].value;
			 if(intervel != "")
			 interval_val = intervel;
		     else
		     interval_val = "";
	
			 var calendar_date = document.form3.date_picker.value;
			
	
			
	
	
			
			
	
			//club_event = $("#club_event").val();
			//Event_Type1 = $("#Event_Type1").val();
			//Event_Type2 = $("#Event_Type2").val();
			//alert(Event_Type1);
			//alert(Event_Type2);
			//Event_Type3 = $("#Event_Type3").val();
			
			/*country = $("#country").val();
			state = $("#state").val();
			city = $("#city").val();
			Select_interval = $("#Select_interval").val();
			
			,
					club_event : club_event,
					Event_Type1 : Event_Type1,
					Event_Type2 : Event_Type2,
					Event_Type3 : Event_Type3,
					country : country,
					state : state,
					city : city,
					Select_interval : Select_interval
			*/
			
			   //alert('Select_interval '+Select_interval);
	        $.ajax({
	            type: "POST",
	            url: "../requires/event_process.php",
	            data: {
	                type : "get_events",
	                eventspage : page,
				    Event_Type1 : Event_Type1, 
					Event_Type2 : Event_Type2, 
					Event_Type3 : Event_Type3,
					club_event : club_eventa,
					country : country_sel,
				    state : state_ss_event,
					city : city_event,
					Select_interval : intervel,
					date_picker : calendar_date
				   
						
	            },
	            success: function(msg) {
	                /*document.write(msg);*/
	                
	                $("#eventlist").html(msg);               
	                
	                /*$(document).ready(function() {
	
	                    $(".zoomimg").fancybox({
	                        'hideOnContentClick': false,
	                        'overlayShow':  true       
	                    });
	                }); 
	                */
	            }
	        }); 

    }
	else if(mod == "polls")
    {
		//alert(page);
		//temp_content = '<div class="clr1"></div>';<div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';
		temp_content = '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';		
		$("#pollslist").html(temp_content);
		var str = self.location.toString();
		var lst = (str.indexOf("lst=my")>-1)?"my":"";
	
        $.ajax({
            type: "POST",
            url: "../requires/polls_process.php",
            data: {
                type : 'get_polls',
                pollspage : page,
				lst:lst
            },
            success: function(msg) {
                /*document.write(msg);*/
                
                var val = $("#pollslist").html(msg);               
                
                /*$(document).ready(function() {

                    $(".zoomimg").fancybox({
                        'hideOnContentClick': false,
                        'overlayShow':  true       
                    });
                }); 
                */
            }
        }); 
    }
	else if(mod == "adminpolls")
    {
		temp_content = '<div class="ylw_head"><div><a name="news">Polls</a></div></div>';
		temp_content = temp_content +'<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';
		//alert(page);
		//temp_content = '<div class="clr1"></div>';<div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';
		//temp_content = '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';		
		$("#admin_pollslist").html(temp_content);
		//var str = self.location.toString();
		//var lst = (str.indexOf("lst=all")>-1)?"all":"";
		//lst:lst
	
        $.ajax({
            type: "POST",
            url: "../requires/polls_process.php",
            data: {
                type : 'get_admin_polls',
                admin_polls_page : page
					   
            },
            success: function(msg) {

                /*document.write(msg);*/
                
                var val = $("#admin_pollslist").html(msg);               
                
                /*$(document).ready(function() {

                    $(".zoomimg").fancybox({
                        'hideOnContentClick': false,
                        'overlayShow':  true       
                    });
                }); 
                */
            }
        }); 
    }
	else if(mod == "invitation")
    {
	
		temp_content = '<div class="ylw_head"><div>Invitations</div></div>';
		temp_content = temp_content +'<div class="clr1"></div><div class="ylw_bdr"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';
		//alert(page);
		//temp_content = '<div class="clr1"></div>';<div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';
		//temp_content = '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';		
		$("#invitation").html(temp_content);
		//var str = self.location.toString();
		//var lst = (str.indexOf("lst=all")>-1)?"all":"";
		//lst:lst
	
        $.ajax({
            type: "POST",
				//url: "../atlg/index.php";
            url: "../requires/invitation_process.php",
            data: {
                type : 'get_next_invitation',
                invitation_page : page
					   
            },
            success: function(msg) {
               /*document.write(msg);*/
               
                 $("#invitation").html(msg);               
                
                /*$(document).ready(function() {

                    $(".zoomimg").fancybox({
                        'hideOnContentClick': false,
                        'overlayShow':  true       
                    });
                }); 
                */
            }
        }); 
    }
	else if(mod == "lectures")
    {
	//alert("test");
		temp_content = '<div class="ylw_head"><div>Guest Lectures</div></div>';
		temp_content = temp_content +'<div class="clr1"></div><div class="ylw_bdr"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';
		//alert(page);
		//temp_content = '<div class="clr1"></div>';<div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';
		//temp_content = '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';		
		//$("#lectures").html(temp_content);
		//var str = self.location.toString();
		//var lst = (str.indexOf("lst=all")>-1)?"all":"";
		//lst:lst
	
        $.ajax({
            type: "POST",
            url: "../requires/lectures_process.php",
            data: {
                type : 'get_next_lectures',
				lectures_page : page
					   
            },
            success: function(msg) {

				 $("#lectures").show(); 
                 $("#lectures").html(msg);               
                
                /*$(document).ready(function() {

                    $(".zoomimg").fancybox({
                        'hideOnContentClick': false,
                        'overlayShow':  true       
                    });
                }); 
                */
            }
        }); 
    }
	else if(mod == "album")
    {
		
		//temp_content = '<div class="clr1"></div>';<div class="ylw_bdr" height="250px"><img src=\"/images/progressbar.gif\"><div class="clr1"></div></div><br/>';
		temp_content = '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';		
		$("#albumlist").html(temp_content);

		var str = self.location.toString();
		var lst = (str.indexOf("lst=my")>-1)?"my":"";

        $.ajax({
            type: "POST",
            url: "../requires/album_process.php",
            data: {
                type : "get_album",
                albumpage : page,
					   lst:lst
            },
            success: function(msg) {
                /*document.write(msg);*/
                
                $("#albumlist").html(msg);               
                
                /*$(document).ready(function() {

                    $(".zoomimg").fancybox({
                        'hideOnContentClick': false,
                        'overlayShow':  true       
                    });
                }); 
                */
            }
        }); 
    }
    else if(mod == "news")
    {
		temp_content = '<div class="ylw_head"><div><a name="news">News</a></div></div>';
		temp_content = temp_content + '<div class="clr1"></div><div class="ylw_bdr" height="250px"><img src=\"../images/progressbar.gif\"><div class="clr1"></div></div><br/>';
        //$("#news_cont").html("<div ><img src=\"/images/progressbar.gif\"></div>");    
		$("#news_cont").html(temp_content);    
        $.ajax({
            type: "POST",
            url: "../requires/news_process.php",
            data: {
                type : "get_news",
                newspage : page
            },
            success: function(msg) {
                /*document.write(msg);*/
                $("#news_cont").html(msg);               
                
                $(document).ready(function() {

                    $(".zoomimg").fancybox({
                        'hideOnContentClick': false,
                        'overlayShow':  true       
                    });
                });                
            }
        }); 
    }
    else if(mod == "letter")
    {
        $("#letter_cont").html("<img src=\"../images/progressbar.gif\">");    
        $.ajax({
            type: "POST",
            url: "../requires/newsletter_process.php",
            data: {
                type : "get_letter",
                letterpage : page
            },
            success: function(msg) {
					//alert(msg);
                /*document.write(msg);*/
                $("#letter_cont").html(msg);  

                $(document).ready(function() {

                    $(".zoomimg").fancybox({
                        'hideOnContentClick': false,
                        'overlayShow':  true       
                    });
                });                
            }
        });
    }
    else if(mod == "jobs")
    {
			document.jobs.action = "index.php?jobspage="+page;
    		document.jobs.submit();
	
		/*//return false;
        $("#job_cont").html("<div height=\"450px\"><img src=\"../images/progressbar.gif\"></div>");    

        $.ajax({
            type: "POST",
            url: "../requires/jobs_process.php",
            data: {
                type : "get_jobs",
                jobspage : page
            },
            success: function(msg) {
					//alert(msg)
				$("#job_cont").show();
                $("#job_cont").html(msg);                
                
            }
        });*/
    }
    else if(mod == "forum")
    {
        $("#orange_container").html("<img src=\"/images/progressbar.gif\">");    

        $.ajax({
            type: "POST",
            url: "/requires/hp_process.php",
            data: {
                type : "get_forums",
                forumspage : page
            },
            success: function(msg) {

                $("#orange_container").html(msg);                
                
            }
        });
    }
    else
    {
        $("#orange_container").html("<img src=\"/images/progressbar.gif\">");    

        $.ajax({
            type: "POST",
            url: "/requires/blogs_list_process.php",
            data: {
                type : "get_blogs",
                blogspage : page
            },
            success: function(msg) {

                $("#orange_container").html(msg);                
                
            }
        });
    }
}

function validate_scrap()
{
    var frm = document.scrap_frm;
    
    var oEditor = FCKeditorAPI.GetInstance('scrap_textarea');
    var FCKeditor1 = oEditor.GetXHTML(true);
    
    if(FCKeditor1 == "")
    {
        alert("Enter the Scrap text");
        return false;
    }        
    /*if (frm.scrap_textarea.value == "")
    {
        alert("Enter the Scrap text");
        frm.scrap_textarea.focus();
        return false;        
    }*/
    if (frm.scrap_photo.value != "" && frm.scrap_photo.value.indexOf(".jpg")==-1 && frm.scrap_photo.value.indexOf(".jpeg")==-1 && frm.scrap_photo.value.indexOf(".JPG")==-1 && frm.scrap_photo.value.indexOf(".JPEG")==-1 && frm.scrap_photo.value.indexOf(".gif")==-1&& frm.scrap_photo.value.indexOf(".GIf")==-1)
    {
        alert("Please upload .jpg, .jpeg and .gif images only.");
        frm.scrap_photo.focus();
        return false;
    }

    frm.action="../requires/profile_process.php";
    frm.submit();
    return false;

    /*action="/requires/profile_process.php"*/
}

function validate_reply(scrap_id)
{
    var frm = eval("document.reply_frm"+scrap_id);
    var reply_textarea = frm.reply_textarea.value;
    var receiver = frm.receiver.value;
    var previous_parent = frm.previous_parent.value;
    var great_parent = frm.great_parent.value;
    var pageid = frm.pageid.value;
    
    if (reply_textarea == "")
    {
        alert("Enter the reply text");
        return false;
    }
    else
    {
        $.ajax({
           type: "POST",
           url: "/requires/profile_process.php",
           data:{
            type : "add_reply",
            reply_textarea : reply_textarea,
            receiver : receiver,
            previous_parent : previous_parent,
            great_parent : great_parent,
            pageid :pageid
           },
           success: function(msg){
                
                $("#myscraps").html(msg); 
               
                $(".zoomimg").fancybox({
                    'hideOnContentClick': false,
                    'overlayShow':  true       
                });
                tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
                imgLoader = new Image();// preload image
                imgLoader.src = tb_pathToImage;               
           }
         });        
    }
}

function get_replyform(scrap_id, great_parent, sender, pageid)
{
	 $.ajax({
       type: "POST",
       url: "/requires/profile_process.php",
       data:{
        type : "get_reply",
        scrap_id : scrap_id,
        great_parent : great_parent,
        sender : sender,
        pageid :pageid
       },
       success: function(msg){
           $("#reply_div"+scrap_id).html(msg);           
       }
     });
}

function cancel_replyform(scrap_id)
{
    $("#reply_div"+scrap_id).html("");
}

function delete_scrap(scrap_id, usrid, pageid)
{
    if(confirm("Are you sure to delete the Scrap?"))
    {
        $("#myscraps").html("<img src=\"/images/progressbar.gif\">");

        $.ajax({
           type: "POST",
           url: "../requires/profile_process.php",
           data:{
            type : "delete_scrap",
            scrap_id : scrap_id,
            usrid : usrid,
            pageid :pageid
           },
           success: function(msg){
               $("#myscraps").html(msg);
           }
         });     
    }
    else
    {
        return false;
    }
}   

function add_scrap_photo()
{
    $("#scrap_photo_div").slideToggle("slow");
}
/*function add_scrap_ytube()
{
    $("#scrap_ytube_div").slideToggle("slow");
}*/

function hideanswer()
{
    if(document.getElementById('captcha').value=="answer ?")
    {
        document.getElementById('captcha').value="";
    } 
}
function inlineanswer()
{
    if(document.getElementById('captcha').value=="")
    {
        document.getElementById('captcha').value="answer ?";
    } 
}
function hidecountry()
{
    if(document.getElementById('phone_country').value=="Country")
    {
        document.getElementById('phone_country').value="";
    } 
}
function inlinecountry()
{
    if(document.getElementById('phone_country').value=="")
    {
        document.getElementById('phone_country').value="Country";
    } 
}
function hidecity()
{
    if(document.getElementById('phone_city').value=="City")
    {
        document.getElementById('phone_city').value="";
    } 
}
function inlinecity()
{
    if(document.getElementById('phone_city').value=="")
    {
        document.getElementById('phone_city').value="City";
    } 
}
function hidephone()
{
    if(document.getElementById('phone_no').value=="Phone No")
    {
        document.getElementById('phone_no').value="";
    } 
}
function inlinephone()
{
    if(document.getElementById('phone_no').value=="")
    {
        document.getElementById('phone_no').value="Phone No";
    } 
}


function usertype_change(user_type)
{
    /*alert(user_type);*/    
    if(user_type == "F")
    {   
        $("#area_div").slideDown("slow");
        $("#batch_div").slideUp("slow");
        $("#course_div").slideUp("slow");
		$("#areaspl_div").slideUp("slow");
		$("#relation_div").slideUp("slow");
        /*$("#area_div").show();*/
        document.getElementById("batch_div").style.display = "none";
        document.getElementById("course_div").style.display = "none";
    }
	else if(user_type == "O")
	{
			$("#relation_div").slideDown("slow");//show
			$("#areaspl_div").slideDown("slow");//show
			$("#area_div").slideUp("slow");//hide
			$("#batch_div").slideUp("slow");
			$("#course_div").slideUp("slow");
			/*$("#area_div").show();*/
			document.getElementById("batch_div").style.display = "none";
			document.getElementById("course_div").style.display = "none";
	}
    else
    {
		$("#relation_div").slideUp("slow");//hide
		$("#areaspl_div").slideUp("slow");//hide
        $("#area_div").slideUp("slow");
        $("#batch_div").slideDown("slow");
        $("#course_div").slideDown("slow");   
        document.getElementById("batch_div").style.display = "inline";
        document.getElementById("course_div").style.display = "inline";

        /*$("#area_div").hide();
        $("#batch_div").show();        
        $("#course_div").show();*/
    }
}

function update_profile(user_id)
{
    $("#profile_div").html("<img src=\"/images/progressbar.gif\">");
    
    $.ajax({
       type: "POST",
       url: "/includes/process.php",
       data:{
        type : "update_profile",
        user_id : user_id
       },
       success: function(msg){
           $("#profile_div").html(msg);
           $("#form1").trigger('validate');
       }
     });       
}

function add_company(new_company)
{
    if(new_company == "")
    {
        alert("Enter the Company Name");
        document.form1.new_company.focus();
        return false;
    }
    else
    {   
        $("#company_div").html("<img src=\"/images/progressbar.gif\">");
        $.ajax({
           type: "POST",
           url: "../includes/process.php",
           data:{
            type : "add_company",
            new_company : new_company
           },
           success: function(msg){
               $("#company_div").html(msg);
           }
         });   
    }
    cancel_company();
}
function cancel_company()
{
    $("#company_form").html("<a href='javascript:;' onClick='company_form();' class='sub_text'>Add Company?</a>");  
}
function company_form()
{
    $("#company_form").html("<img src=\"/images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "company_form"
       },
       success: function(msg){
           $("#company_form").html(msg);
       }
     });        
}

function country_form()
{
    $("#country_form").html("<img src=\"../images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "country_form"
       },
       success: function(msg){
           $("#country_form").html(msg);
       }
     });        
}

function add_country(new_country)
{
	//alert(new_country);
	//return false;
    if(new_country == "")
    {
        alert("Enter the Country Name");
        document.form1.new_country.focus();
        return false;
    }
    else
    {   
        $("#country_div").html("<img src=\"../images/progressbar.gif\">");
        $.ajax({
           type: "POST",
           url: "../includes/process.php",
           data:{
            type : "add_country",
            new_country : new_country
           },
           success: function(msg){
               $("#new_count").html(msg);
           }
         });   
    }
    cancel_country();
}

function cancel_country()
{
    $("#country_form").html("<a href='javascript:;' onClick='country_form();' class='sub_text'>Add country?</a>");  
}
function state_form(country_id)
{
	//alert(country_id);
	//return false;
	if(country_id == 0){
		alert("Please select country");
		$("#country").focus();
		return false;

	}
    $("#state_form").html("<img src=\"../images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "state_form",
		country : country_id
		
       },
       success: function(msg){
           $("#state_form").html(msg);
       }
     });        
}
function add_state(new_state)
{
	
	var country = $("#country").val();
    if(new_state == "")
    {
        alert("Enter the State Name");
        document.form1.new_state.focus();
        return false;
    }
    else
    {   
        $("#state_div").html("<img src=\"../images/progressbar.gif\">");
        $.ajax({
           type: "POST",
           url: "../includes/process.php",
           data:{
            type : "add_state",
            country_id : country,
			new_state : new_state
           },
           success: function(msg){
               $("#state_div").html(msg);
           }
         });   
    }
    cancel_state();
}

function cancel_state()
{
    $("#state_form").html("<a href='javascript:;' onClick='state_form();' class='sub_text'>Add State?</a>");  
}
function city_form(state_id)
{
	var state = $("#state").val();
 // alert(state);
  //return false;
	if(state == 0){
		alert("Please select state");
		$("#state").focus();
		return false;

	}
    $("#city_form").html("<img src=\"../images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "city_form"
       },
       success: function(msg){
           $("#city_form").html(msg);
       }
     });        
}
function add_city(new_city)
{
	
	var state = $("#state").val();
    if(new_city == "")
    {
        alert("Enter the State Name");
        document.form1.new_city.focus();
        return false;
    }
    else
    {   
        $("#city_div").html("<img src=\"../images/progressbar.gif\">");
        $.ajax({
           type: "POST",
           url: "../includes/process.php",
           data:{
            type : "add_city",
            state_id : state,
			new_city : new_city
           },
           success: function(msg){
               $("#city_div").html(msg);
           }
         });   
    }
    cancel_city();
}

function cancel_city()
{
    $("#city_form").html("<a href='javascript:;' onClick='city_form();' class='sub_text'>Add City?</a>");  
}

function add_album(new_album)
{
    if(new_album == "")
    {
        alert("Enter the Album Name");
        document.form1.new_album.focus();
        return false;
    }
    else
    {   
        $("#album_div").html("<img src=\"/images/progressbar.gif\">");
        $.ajax({
           type: "POST",
           url: "../includes/process.php",
           data:{
            type : "add_album",
            new_album : new_album
           },
           success: function(msg){
				var split_val=msg.split('~');
				if(split_val[1]=="0")
				{
					 $("#name_exists").show();
					 $("#name_exists").html('Album Name Already Exists');
				}
				
               $("#album_div").html(split_val[0]);
           }
         });   
    }
    cancel_album();
}



function cancel_album()
{
    $("#album_name").html("&nbsp;<a href='javascript:;' onClick='album_name();' class='sub_text'>Add new album</a>");  
}

function album_name()
{
	$("#name_exists").hide();
    $("#album_name").html("<img src=\"/images/progressbar.gif\">");
	 
    $.ajax({
		  
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "album_name"
       },
       success: function(msg){
           $("#album_name").html(msg);
       }
     });        
}

/*function album_name_edit(id, name)
{
	//alert(id);
	
    $("#album_name_edit").html("<img src=\"/images/progressbar.gif\">");
	 
    $.ajax({
		  
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "album_name_edit",
		album_id : id,
		album_name : name
		
       },
       success: function(msg){
           $("#album_name_edit").html(msg);
       }
     });        
}
*/

function album_detail()
{
    $("#album_detail").html("<img src=\"/images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "album_detail"
       },
       success: function(msg){
           $("#album_detail").html(msg);
       }
     });        
}


function get_states(country_id)
{
	//Add_Event_RemoveErrmsg();
    $("#state_div").html("<img src=\"../images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "get_state",
        country_id : country_id
       },
       success: function(msg){
           $("#state_div").html(msg);
       }
     });
     
     get_city(0);     
}
function registration_get_states(country_id)
{
	//Add_Event_RemoveErrmsg();
    $("#state_div").html("<img src=\"../images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "get_state_reg",
        country_id : country_id
       },
       success: function(msg){
           $("#state_div").html(msg);
       }
     });
     
     registration_get_city(0);     
}
function get_city(state_id)
{
	if(state_id !=""){
	//Add_Event_RemoveErrmsg();
	}
    $("#city_div").html("<img src=\"../images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "get_city",
        state_id : state_id
       },
       success: function(msg){
           $("#city_div").html(msg);
       }
     });    
}

function registration_get_city(state_id)
{
	if(state_id !=""){
	//Add_Event_RemoveErrmsg();
	}
    $("#city_div").html("<img src=\"../images/progressbar.gif\">");
    $.ajax({
       type: "POST",
       url: "../includes/process.php",
       data:{
        type : "get_city_reg",
        state_id : state_id
       },
       success: function(msg){
           $("#city_div").html(msg);
       }
     });    
}


function remove_msg(){
	//Add_Event_RemoveErrmsg();
}

function create_crud(module , page)
{

    $("#"+div_id).html("<table width='100%' border='0'><tr><td align='center' style='padding-top:100px;'>Processing...</td></tr></table>");
    $.ajax({
       type: "POST",
       url: module+".php",
       data:{
        type : "create",
        page : page
       },
       success: function(msg){
           $("#"+div_id).html(msg);
       }
     });
    
}

function edit_crud(module, page, id)
{
    $("#"+div_id).html("<table width='100%' border='0'><tr><td align='center' style='padding-top:100px;'>Processing...</td></tr></table>");

    $.ajax({
       type: "POST",
       url: module+".php",
       data:{
        type : "edit",
        id : id,
        page : page
       },
       success: function(msg){
           $("#"+div_id).html(msg);
       }
     });
}

function view_crud(module, page, id)
{

    
    $("#"+div_id).html("<table width='100%' border='0'><tr><td align='center' style='padding-top:100px;'>Processing...</td></tr></table>");

    $.ajax({
       type: "POST",
       url: module+".php",
       data:{
        type : "view",
        id : id,
        page : page
       },
       success: function(msg){
           $("#"+div_id).html(msg);
       }
     });
}


function delete_image(div_id , image_id, artwork_id, image_name)
{
    
    
    if((confirmation = confirm("Are you sure to delete this image?")) == true)
    {
        document.getElementById("loading_img"+image_id).src = '/images/loading.gif';      
        
        $.ajax({
       type: "POST",
       url: "artworks.php",
       data:{
        type : "single_delete",
        artwork_id : artwork_id,
        image_id : image_id,
        image_name : image_name
       },
       success: function(msg){
           $("#"+div_id+image_id).hide();
       }
     });
    }
}


function removeFileTab(TblName, ImgCount)
{
    var check=confirm("Are you sure you want to remove this row?");

    if(check == true)
    {
        oTBody = document.getElementById(TblName);
        var lastRow = oTBody.rows.length;

        oTBody.deleteRow(lastRow-1);

        document.getElementById(ImgCount).value = document.getElementById(ImgCount).value - 1;
    }
}

 
// Add more images

function addFileTab(TblName, ImgCount, eleName)
{   

    oTBody = document.getElementById(TblName);

    var lastRow = oTBody.rows.length;     


    oTBody.insertRow(lastRow);
    var oinput = document.createElement("input");
    oinput.setAttribute("type", "file");
    oinput.setAttribute("name", eleName+lastRow);
    oinput.setAttribute("id", eleName+lastRow);
    oTBody.rows[lastRow].insertCell(0);
    oTBody.rows[lastRow].cells[0].align = "left";

    oTBody.rows[lastRow].cells[0].className="darktd";
    oTBody.rows[lastRow].cells[0].appendChild(oinput);

    var oinput = document.createElement("a");
    oinput.setAttribute("href", "javascript:removeFileTab('"+TblName+"', '"+ImgCount+"')");
    oinput.appendChild(document.createTextNode("Delete"));
    oTBody.rows[lastRow].insertCell(1);
    oTBody.rows[lastRow].cells[1].align = "left";
    oTBody.rows[lastRow].cells[1].appendChild(oinput);

    document.getElementById(ImgCount).value = parseInt(document.getElementById(ImgCount).value) + 1;

}


function removeTextTab(TblName, ImgCount)
{
    var check=confirm("Are you sure you want to remove this row?");

    if(check == true)
    {
        oTBody = document.getElementById(TblName);
        var lastRow = oTBody.rows.length;
        oTBody.deleteRow(lastRow-1);

        document.getElementById(ImgCount).value = document.getElementById(ImgCount).value - 1;
    }
}

 
 
function addTextTab(TblName, ImgCount, eleName)
{
    oTBody = document.getElementById(TblName);

    var lastRow = oTBody.rows.length;     

    oTBody.insertRow(lastRow);
    var oinput = document.createElement("input");
    oinput.setAttribute("type", "text");
    oinput.setAttribute("name", eleName+lastRow);
    oinput.setAttribute("class", "txtbox");
    oinput.setAttribute("id", eleName+lastRow);
    oTBody.rows[lastRow].insertCell(0);
    oTBody.rows[lastRow].cells[0].align = "left";

    oTBody.rows[lastRow].cells[0].className="darktd";
    oTBody.rows[lastRow].cells[0].appendChild(oinput);

    var oinput = document.createElement("a");
    oinput.setAttribute("href", "javascript:removeFileTab('"+TblName+"', '"+ImgCount+"')");
    oinput.appendChild(document.createTextNode("Delete"));
    oTBody.rows[lastRow].insertCell(1);
    oTBody.rows[lastRow].cells[1].align = "left";
    oTBody.rows[lastRow].cells[1].appendChild(oinput);

    document.getElementById(ImgCount).value = parseInt(document.getElementById(ImgCount).value) + 1;

}

function function_check(title)
{
    //$("#profile_div").html("<img src=\"/images/progressbar.gif\">");
    
    $.ajax({
       type: "POST",
       url: "/jobs/process_jobs.php",
       data:{
        type : "check_title",
        "pval['title']" : title
       },
       success: function(msg){
           $("#profile_div").html(msg);           
       }
     });       
}

function delete_jobs(id)
{  
    if(confirm("Are you sure to delete the selected item?"))
    {           
        document.jobs.action="../requires/jobs_process.php?type=delete&id="+id;
        document.jobs.submit();
    }
}

function search_validate()
{
	
  var frm = document.search;
  if(frm.ser_txt.value== "")
  {
  alert("Please Enter Search value");
  frm.ser_txt.focus();
  return false;
  }

  else
  {
	  //alert("test");
    
    var val = frm.ser_txt.value;
    // frm.action = "search/index.php?type="+val;
	 // frm.submit();
  }
}

jQuery(".splash_msg").ready(
	function(){
		jQuery(".splash_msg").fadeOut(2000);
	}
);

function registration_ajax(lecture_id,user_id)
{

       document.getElementById(lecture_id).style.display = "inline";
        var url_list = "../includes/process.php?type=update_register&lec_id="+lecture_id+"&use_id="+user_id;
       if(window.ActiveXObject) //IE
       {
        objXmlHTTP= new ActiveXObject("Microsoft.XMLHTTP");
       }
       else //Other browser
       {
        objXmlHTTP= new XMLHttpRequest();
       }
     
       var next_data = "";
       objXmlHTTP.open("GET",url_list,false);
       objXmlHTTP.send("");
       next_data = objXmlHTTP.responseText;
	   document.getElementById("reg_"+lecture_id).style.display = 'none';
       setTimeout("document.getElementById("+lecture_id+").style.display = 'none'",2000);
       //document.getElementById(lecture_id).style.display = "none";
       return next_data;
       
}
/*function check_username(formname, field, msg, checking, mode)
{

    var frm = eval("document."+formname+"."+field+".value");
    
    if (frm == "")
    {
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
        
        $("#"+field).after('<label id="label_'+field+'" class="error" style="color:red;display:inline;"><br/>'+msg+'</label>');
        document.getElementById("btn_create").disabled = true;
        return false;
    }
    else
    {
        document.getElementById("btn_create").disabled = false;
        if($("#label_"+field)) {
            $("#label_"+field).remove();
        }
    }
}*/
 function sentenceCase(str) {

// callback function for regex replace
var replacer = function(match, endmark, cap) {
if (endmark) {
return endmark + cap.toUpperCase();
} else {
return match.toUpperCase();
}
};

return str
.replace(/^[a-z]/, replacer)
.replace(/([.!?]\s+)([a-z])/g, replacer);
}
   

