// JavaScript Document
// Hydro Power Plants
function theRotator_hprj() {
	//Set the opacity of all images to 0
	$('div.rotator_hprj ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.rotator_hprj ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval("rotate_hprj()", 6000);
	
}

function rotate_hprj() {	
	//Get the first image
	var current = ($('div.rotator_hprj ul li.show_hprj')?  $('div.rotator_hprj ul li.show_hprj') : $('div.rotator_hprj ul li:first'));

    if ( current.length == 0 ) current = $('div.rotator_hprj ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show_hprj')) ? $('div.rotator_hprj ul li:first') :current.next()) : $('div.rotator_hprj ul li:first'));
	
	//Un-comment the 3 lines below to get the images in random order
	
	//var sibs = current.siblings();
    //var rndNum = Math.floor(Math.random() * sibs.length );
    //var next = $( sibs[ rndNum ] );
			

	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show_hprj')
	.animate({opacity: 1.0}, 3000);

	//Hide the current image
	current.animate({opacity: 0.0}, 3000)
	.removeClass('show_hprj');
	
};

//thermal Power Plants
function theRotator_tprj() {
	//Set the opacity of all images to 0
	$('div.rotator_tprj ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.rotator_tprj ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	
	setInterval("rotate_tprj()",3500);
	
}

function rotate_tprj() {	
	//Get the first image
	var current = ($('div.rotator_tprj ul li.show_tprj')?  $('div.rotator_tprj ul li.show_tprj') : $('div.rotator_tprj ul li:first'));

    if ( current.length == 0 ) current = $('div.rotator_tprj ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show_tprj')) ? $('div.rotator_tprj ul li:first') :current.next()) : $('div.rotator_tprj ul li:first'));
	
	//Un-comment the 3 lines below to get the images in random order
	
	//var sibs = current.siblings();
    //var rndNum = Math.floor(Math.random() * sibs.length );
    //var next = $( sibs[ rndNum ] );
			

	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show_tprj')
	.animate({opacity: 1.0}, 3000);

	//Hide the current image
	current.animate({opacity: 0.0}, 3000)
	.removeClass('show_tprj');
	
};

//Oil, Gas & Petrochemical 
function theRotator_oprj() {
	//Set the opacity of all images to 0
	$('div.rotator_oprj ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.rotator_oprj ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval("rotate_oprj()", 5000);
	
}

function rotate_oprj() {	
	//Get the first image
	var current = ($('div.rotator_oprj ul li.show_oprj')?  $('div.rotator_oprj ul li.show_oprj') : $('div.rotator_oprj ul li:first'));

    if ( current.length == 0 ) current = $('div.rotator_oprj ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show_oprj')) ? $('div.rotator_oprj ul li:first') :current.next()) : $('div.rotator_oprj ul li:first'));
	
	//Un-comment the 3 lines below to get the images in random order
	
	//var sibs = current.siblings();
    //var rndNum = Math.floor(Math.random() * sibs.length );
    //var next = $( sibs[ rndNum ] );
			

	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show_oprj')
	.animate({opacity: 1.0}, 3000);

	//Hide the current image
	current.animate({opacity: 0.0}, 3000)
	.removeClass('show_oprj');
	
};

//Railway Industries
function theRotator_gprj() {
	//Set the opacity of all images to 0
	$('div.rotator_gprj ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.rotator_gprj ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	
	setInterval("rotate_gprj()",2000);
	
}

function rotate_gprj() {	
	//Get the first image
	var current = ($('div.rotator_gprj ul li.show_eprj')?  $('div.rotator_gprj ul li.show_gprj') : $('div.rotator_gprj ul li:first'));

    if ( current.length == 0 ) current = $('div.rotator_gprj ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show_gprj')) ? $('div.rotator_gprj ul li:first') :current.next()) : $('div.rotator_gprj ul li:first'));
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show_gprj')
	.animate({opacity: 1.0}, 3000);

	//Hide the current image
	current.animate({opacity: 0.0}, 3000)
	.removeClass('show_gprj');
	
};

//Electrical Management
function theRotator_eprj() {
	//Set the opacity of all images to 0
	$('div.rotator_eprj ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.rotator_eprj ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	
	setInterval("rotate_eprj()",2000);
	
}

function rotate_eprj() {	
	//Get the first image
	var current = ($('div.rotator_eprj ul li.show_eprj')?  $('div.rotator_eprj ul li.show_eprj') : $('div.rotator_eprj ul li:first'));

    if ( current.length == 0 ) current = $('div.rotator_eprj ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show_eprj')) ? $('div.rotator_eprj ul li:first') :current.next()) : $('div.rotator_eprj ul li:first'));
	
	//Un-comment the 3 lines below to get the images in random order
	
	//var sibs = current.siblings();
    //var rndNum = Math.floor(Math.random() * sibs.length );
    //var next = $( sibs[ rndNum ] );
			

	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show_eprj')
	.animate({opacity: 1.0}, 3000);

	//Hide the current image
	current.animate({opacity: 0.0}, 3000)
	.removeClass('show_eprj');
	
};

//Other Projects
function theRotator_dprj() {
	//Set the opacity of all images to 0
	$('div.rotator_dprj ul li').css({opacity: 0.0});
	
	//Get the first image and display it (gets set to full opacity)
	$('div.rotator_dprj ul li:first').css({opacity: 1.0});
		
	//Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
	
	setInterval("rotate_dprj()",2000);
	
}

function rotate_dprj() {	
	//Get the first image
	var current = ($('div.rotator_dprj ul li.show_dprj')?  $('div.rotator_dprj ul li.show_dprj') : $('div.rotator_dprj ul li:first'));

    if ( current.length == 0 ) current = $('div.rotator_dprj ul li:first');

	//Get next image, when it reaches the end, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('show_dprj')) ? $('div.rotator_dprj ul li:first') :current.next()) : $('div.rotator_dprj ul li:first'));
	
	//Set the fade in effect for the next image, the show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show_dprj')
	.animate({opacity: 1.0}, 3000);

	//Hide the current image
	current.animate({opacity: 0.0}, 3000)
	.removeClass('show_dprj');
	
};
