// JavaScript Document
$(document).ready(function() {


    // Array of Quotes for Home Page
    var arr = ["c1", "c2", "c3"];

    // Hide all Quotes
/*    $.each(arr, function(){
        $("."+this).hide();
    });*/
    
    // Show one quote Randomly
    // 1. Shuffle Array
    for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x);

    // 2. Show the first Position
    $("."+arr[0]).show();
    
    



    if (document.URL.indexOf('index.php')!= -1) {
        thelink = "../";
    }
    else {
        thelink = "";
    }
    
    $.preloadImages(thelink+"system/application/img/custom-solutions_over.png",thelink+"system/application/img/design-and-themes_over.png",thelink+"system/application/img/custom-migration_over.png",thelink+"system/application/img/custom-migration_over.png",thelink+"system/application/img/contac_us_over.png");


    $('.custom_solutions').mouseover(function() {
        $(this).attr('src',thelink+'system/application/img/custom-solutions_over.png');
    });
    $('.custom_solutions').mouseout(function() {
		$(this).attr('src',thelink+'system/application/img/custom-solutions.png');
    });
	$('.custom_solutions').click(function() {
		location.href=thelink+"index.php/site/services/custom_moodle_solutions/process_details";
	});

	$('.design_and_themes').mouseover(function() {
		$(this).attr('src',thelink+'system/application/img/design-and-themes_over.png');
    });
    $('.design_and_themes').mouseout(function() {
		$(this).attr('src',thelink+'system/application/img/design-and-themes.png');
    });
    $('.design_and_themes').click(function() {
        location.href=thelink+"index.php/site/services/interface_design/what_can_we_do";
    });

	$('.course_migration').mouseover(function() {
		$(this).attr('src',thelink+'system/application/img/custom-migration_over.png');
    });
    $('.course_migration').mouseout(function() {
		$(this).attr('src',thelink+'system/application/img/custom-migration.png');
    });
    $('.course_migration').click(function() {
        location.href=thelink+"index.php/site/services/course_migration/course_migration";
    });



    $('#contactus').mouseover(function() {
        $(this).css({background:'transparent url('+thelink+'system/application/img/contac_us_over.png) no-repeat center center'});
    });
    $('#contactus').mouseout(function() {
        $(this).css({background:'transparent url('+thelink+'system/application/img/contac_us.png) no-repeat center center'});
    });
    $('#contactus').click(function() {
        location.href=thelink+"index.php/site/contact";
    });
	
	
	$('.download_img').mouseover(function() {
		$(this).attr('src','../../../../system/application/img/download_over.png');
    });
    $('.download_img').mouseout(function() {
		$(this).attr('src','../../../../system/application/img/download.png');
    });
	
	
});

jQuery.preloadImages = function() {
    for(var i = 0; i<arguments.length; i++) {
        jQuery("<img>").attr("src", arguments[i]);
    }
}
