//slide page to id


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');
    $active.addClass('last-active');

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

function footerslideSwitch() {
    var $active = $('#footerslideshow IMG.active');

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

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

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

function mypopup(file){
   mywindow = window.open (file,"mywindow","location=0,status=0,scrollbars=1,width=700,height=770,left=50,top=50");
} 
$(document).ready(function($){
    //for popup
    $('.popup').click(function(e){
        e.preventDefault();
        var tarref = $(this).attr("href");
        mypopup(tarref);
    });
    
    $('.home img').hover(function(){
      $(".home img").attr("src",siteurl+"images/homebtn_select.gif");

    },function(){
        $(".home img").attr("src",siteurl+"images/homebtn.gif");

    });
});


//to validate appointment form
function validateform(frm,type){
    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
    var fullname = jQuery('#fullname').val();
    var schoolname = jQuery('#schoolname').val();
    var contact = jQuery('#contact').val();
    var contactnumber = jQuery('#contactnumber').val();
    var role = jQuery('#role').val();
    var emailid = jQuery('#emailid').val();
    var noschools_institution = jQuery('#noschools_institution').val();
    var classes = jQuery('#classes').val();
    var existing_service = jQuery('#existing_service').val();
    var rumi_product_interest = jQuery('#rumi_product_interest').val();
    var comments = jQuery('#comments').val();
    
    emailid=jQuery.trim(emailid);
    if(fullname=='0' || fullname==''){
        alert("Please enter Your Full Name");
        jQuery('#fullname').focus();
        return false;
    }
    if(schoolname=='0' || schoolname==''){
        alert("Please enter Name of Your "+type+"");
        jQuery('#schoolname').focus();
        return false;
    }
    if(contact=='0' || contact==''){
        alert("Please enter Your Contact/ "+type+" Address");
        jQuery('#contact').focus();
        return false;
    }
    if(contactnumber=='0' || contactnumber==''){
        alert("Please enter Your Contact Numbers");
        jQuery('#contactnumber').focus();
        return false;
    }
    if(role=='0' || role==''){
        alert("Please enter Your Role in the "+type+"");
        jQuery('#role').focus();
        return false;
    }
    
    
    if(emailid=='0' || emailid==''){
        alert("Please enter Your email id");
        jQuery('#emailid').focus();
        return false;
    }
    
    if(reg.test(emailid) == false) {
        alert('Please enter valid email');
        jQuery('#emailid').focus();
        return false;
    }
    
    if(type=='Institution'){
    if(noschools_institution=='0' || noschools_institution==''){
        alert("Please enter No. of Schools your Institution runs");
        jQuery('#noschools_institution').focus();
        return false;
    }
    }
    if(classes=='0' || classes==''){
        alert("Please enter Classes/Standards Available");
        jQuery('#classes').focus();
        return false;
    }
    if(existing_service=='0' || existing_service==''){
        alert("Please enter Your Existing Service Providers");
        jQuery('#existing_service').focus();
        return false;
    }
    if(rumi_product_interest=='0' || rumi_product_interest==''){
        alert("Please enter RUMI's Products/Services that you interest you");
        jQuery('#rumi_product_interest').focus();
        return false;
    }
    if(comments=='0' || comments==''){
        alert("Please enter Tell us your dream for your "+type+" in a few sentence");
        jQuery('#comments').focus();
        return false;
    }
    
   
}

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-5372934-2");
pageTracker._trackPageview();
} catch(err) {}

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18775997-5']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
