Difference between revisions of "MediaWiki:Common.js"

From MadaCamp
Jump to: navigation, search
Line 2: Line 2:
  
 
//alert(document.location.href)
 
//alert(document.location.href)
 +
 +
if (document.location.href == "http://www.madacamp.com/Test")[
 +
document.getElementsById('map1').style.width = '100%';
 +
 +
}
  
 
var RecaptchaOptions = {
 
var RecaptchaOptions = {

Revision as of 13:19, 31 October 2012

/* Any JavaScript here will be loaded for all users on every page load. */

//alert(document.location.href)

if (document.location.href == "http://www.madacamp.com/Test")[
document.getElementsById('map1').style.width = '100%';

}

var RecaptchaOptions = {
    theme : 'white'
 };


/* start rotating banner */
/* Banner 147x85 */
/* Add image and URL in array and upload/protect image and preload
   (first letter or image name must be capitalised) */

/* define the images directory including trailing slash */
var madacamp_banner_dir = '/images/madagascar/';

/* The arrays with images and their corresponding URLs */

var madacamp_banners = new Array("Anakao_banner.jpg",
                        "Namako_banner_01.jpg",
                        "Diego_Suarez_banner.jpg",
                        "Baobab_Avenue_banner.png",
                        "Sakalava_Bay_banner.jpg",
                        "Morondava_banner.jpg",
                        "Peter_Pan_banner.jpg",
                        "Safari_Vezo_banner.jpg",
                        "Ankarana_National_Park_banner_01.jpg",
                        "Ankarana_National_Park_banner_03.jpg",
                        "Ankarafantsika_National_Park_banner_01.jpg",
                        "Sambirano_banner_01.jpg",
                        "Tana_Jacaranda_banner_01.jpg",
                        "Hotel_Carlton_banner_01.jpg",
                        "Ambohimanga_banner_01.jpg",
                        "Isalo_National_Park_banner_01.jpg",
                        "Isalo_National_Park_banner_02.jpg",
                        "Isalo_National_Park_banner_03.jpg",
                        "Isalo_National_Park_banner_04.jpg",
                        "Antsirabe_banner_01.jpg",
                        "Chez_Haga_banner_01.jpg");

 
var madacamp_links = new Array("/admin/madacamp.com/redirect.cgi?url=/Anakao",
                             "/admin/madacamp.com/redirect.cgi?url=/Namako",
                             "/admin/madacamp.com/redirect.cgi?url=/Diego_Suarez",
                             "/admin/madacamp.com/redirect.cgi?url=/Baobab_Avenue",
                             "/admin/madacamp.com/redirect.cgi?url=/Sakalava_Bay",
                             "/admin/madacamp.com/redirect.cgi?url=/Morondava",
                             "/admin/madacamp.com/redirect.cgi?url=/Peter_Pan",
                             "/admin/madacamp.com/redirect.cgi?url=/Safari_Vezo",
                             "/admin/madacamp.com/redirect.cgi?url=/Ankarana_National_Park",
                             "/admin/madacamp.com/redirect.cgi?url=/Ankarana_National_Park", 
                             "/admin/madacamp.com/redirect.cgi?url=/Ankarafantsika_National_Park",
                             "/admin/madacamp.com/redirect.cgi?url=/Sambirano",
                             "/admin/madacamp.com/redirect.cgi?url=/Tana_Jacaranda",
                             "/admin/madacamp.com/redirect.cgi?url=/Hotel_Carlton",
                             "/admin/madacamp.com/redirect.cgi?url=/Ambohimanga",
                             "/admin/madacamp.com/redirect.cgi?url=/Isalo_National_Park",
                             "/admin/madacamp.com/redirect.cgi?url=/Isalo_National_Park",
                             "/admin/madacamp.com/redirect.cgi?url=/Isalo_National_Park",
                             "/admin/madacamp.com/redirect.cgi?url=/Isalo_National_Park",
                             "/admin/madacamp.com/redirect.cgi?url=/Antsirabe",
                             "/admin/madacamp.com/redirect.cgi?url=/Chez_Haga");

function start_animation(){
setTimeout('madacamp_blender()',15000); /* 15 second */
}

madacamp_banner_01 = new Image(147,85);
madacamp_banner_01.src = madacamp_banner_dir + "Anakao_banner.jpg";

madacamp_banner_02 = new Image(147,85);
madacamp_banner_02.src = madacamp_banner_dir + "Namako_banner_01.jpg";

madacamp_banner_03 = new Image(147,85);
madacamp_banner_03.src = madacamp_banner_dir + "Diego_Suarez_banner.jpg";

madacamp_banner_04 = new Image(147,85);
madacamp_banner_04.src = madacamp_banner_dir + "Baobab_Avenue_banner.png";

madacamp_banner_05 = new Image(147,85);
madacamp_banner_05.src = madacamp_banner_dir + "Sakalava_Bay_banner.jpg";

madacamp_banner_06 = new Image(147,85);
madacamp_banner_06.src = madacamp_banner_dir + "Morondava_banner.jpg";

madacamp_banner_07 = new Image(147,85);
madacamp_banner_07.src = madacamp_banner_dir + "Peter_Pan_banner.jpg";

madacamp_banner_08 = new Image(147,85);
madacamp_banner_08.src = madacamp_banner_dir + "Safari_Vezo_banner.jpg";

madacamp_banner_09 = new Image(147,85);
madacamp_banner_09.src = madacamp_banner_dir + "Ankarana_National_Park_banner_01.jpg";

madacamp_banner_10 = new Image(147,85);
madacamp_banner_10.src = madacamp_banner_dir + "Ankarana_National_Park_banner_03.jpg";

madacamp_banner_11 = new Image(147,85);
madacamp_banner_11.src = madacamp_banner_dir + "Ankarafantsika_National_Park_banner_01.jpg";

madacamp_banner_12 = new Image(147,85);
madacamp_banner_12.src = madacamp_banner_dir + "Sambirano_banner_01.jpg";

madacamp_banner_13 = new Image(147,85);
madacamp_banner_13.src = madacamp_banner_dir + "Tana_Jacaranda_banner_01.jpg";

madacamp_banner_14 = new Image(147,85);
madacamp_banner_14.src = madacamp_banner_dir + "Hotel_Carlton_banner_01.jpg";

madacamp_banner_15 = new Image(147,85);
madacamp_banner_15.src = madacamp_banner_dir + "Ambohimanga_banner_01.jpg";

madacamp_banner_16 = new Image(147,85);
madacamp_banner_16.src = madacamp_banner_dir + "Isalo_National_Park_banner_01.jpg";

madacamp_banner_17 = new Image(147,85);
madacamp_banner_17.src = madacamp_banner_dir + "Isalo_National_Park_banner_02.jpg";

madacamp_banner_18 = new Image(147,85);
madacamp_banner_18.src = madacamp_banner_dir + "Isalo_National_Park_banner_03.jpg";

madacamp_banner_19 = new Image(147,85);
madacamp_banner_19.src = madacamp_banner_dir + "Isalo_National_Park_banner_04.jpg";

madacamp_banner_20 = new Image(147,85);
madacamp_banner_20.src = madacamp_banner_dir + "Antsirabe_banner_01.jpg";

madacamp_banner_21 = new Image(147,85);
madacamp_banner_21.src = madacamp_banner_dir + "Chez_Haga_banner_01.jpg";


function madacamp_swap(){
opacity = 0;
IE_opacity = 0;

if (navigator.appVersion.indexOf("MSIE") != -1){
document.getElementById("blendinger").style.filter = "alpha(opacity=0)";
interval = setInterval("blendinger_IE()",50)

}
else {
document.getElementById("blendinger").style.opacity=0;
interval = setInterval("blendinger_opacity()",50)
}
}

function blendinger_IE(){
if (IE_opacity < 100){
IE_opacity = IE_opacity +4;
document.getElementById("blendinger").style.filter = "alpha(opacity="+IE_opacity+")";

}

else{
clearInterval(interval);
IE_count = 0;
}
}

function blendinger_opacity(){
 
if (opacity < 1){
opacity = (Math.floor(opacity * 100) +4) / 100;
document.getElementById("blendinger").style.opacity=opacity;

}
else{
clearInterval(interval);

}
}

var madacamp_array_index = madacamp_links.length -1;
var first_madacamp_index = Math.round(madacamp_array_index * Math.random())

var madacamp_cycle = first_madacamp_index;
var madacamp_total = madacamp_banners.length -1;
var madacamp_link = madacamp_links[madacamp_cycle]; /* initially the first */

function madacamp_blender(){

/* first set current image as background */

document.getElementById('background_image').style.backgroundImage='url('+madacamp_banner_dir+madacamp_banners[madacamp_cycle]+')';

madacamp_cycle++;

if (madacamp_cycle == madacamp_banners.length){
madacamp_cycle = 0;
}
 
madacamp_swap();

setTimeout("document.images.madacamp_animation.src=madacamp_banner_dir + madacamp_banners[madacamp_cycle];",10)
               
madacamp_link = madacamp_links[madacamp_cycle] /* update link values */
 
}

/* end rotaing banner */