//for highslide *************************************************************************************
hs.graphicsDir = 'js/highslide/graphics/';	//graphics folder for hs
hs.captionEval = 'this.a.title'; 						//get the link title and use it as caption
hs.transitions = ["expand"]; 								//options: ["expand"] , ["fade"]
hs.outlineType = 'drop-shadow'; 						//options: 'rounded-white', 'outer-glow', 'drop-shadow', null
hs.loadingOpacity = 0.75;										//alpha for loading div only
hs.showCredits = false;
hs.captionSlideSpeed = 1; 									// set to 0 to disable slide in effect

hs.expandSteps = 50;
hs.expandDuration = 200;
hs.restoreSteps = 50;
hs.restoreDuration = 200;

hs.marginLeft = 15;
hs.marginRight = 15;
hs.marginTop = 15;
hs.marginBottom = 15;
hs.align = 'center';
hs.outlineWhileAnimating = true;
hs.restoreTitle = '';

// always use this with flash, else the movie will be stopped on close:
hs.preserveContent = false;

//GROUP NAVIGATION. To have a group with all images having class="highslide" class (see tinyMCE.css, the class is there)
hs.onSetClickEvent = function ( sender, e ) {
   // set the onclick for the element, output the group name to the caption for debugging
   e.element.onclick = function () {
      return hs.expand(this, { slideshowGroup: this.parentNode.className, 
         captionText: this.parentNode.className });
   }
   // return false to prevent the onclick being set once again
   return false;
}
//***************************************************************************************************

//for rollOvers *************************************************************************************
function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}
function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}
//***************************************************************************************************


//delete confirmation
function confirmMsg(msg) {
  document.returnValue = confirm(msg);
}


//pour color_pick
function popup(color,inputid) {
	var iMyWidth;
	var iMyHeight;
	iMyWidth = (window.screen.width/2) - (75 + 10);
	iMyHeight = (window.screen.height/2) - (100 + 50);
	var win2 = window.open("js/colorpicker/colorpicker.php?inputid=" + inputid + "&color=" + color,"Window2","status=no,height=290,width=225,resizable=1,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
	win2.focus();
}

//classic pop-up general uses
function popUp(URL,l,h) {
	id = 'popup';
	var iMyWidth;
	var iMyHeight;
	iMyWidth = (screen.width) ? (screen.width-l)/2 : 0;
	iMyHeight = (screen.height) ? (screen.height-h)/2 : 0;
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+ l +",height="+ h +",left = "+ iMyWidth +",top = "+ iMyHeight +"');");
}

// chargement alléatoire des images top pour template "default"
function randomImg() {
	var j,d="",l="",m="",p="",q="",z="",list= new Array()
	
	list[list.length]='templates/alex/img/top1.jpg';
	list[list.length]='templates/alex/img/top2.jpg';
	list[list.length]='templates/alex/img/top3.jpg';
	list[list.length]='templates/alex/img/top4.jpg';
	list[list.length]='templates/alex/img/top5.jpg';
	list[list.length]='templates/alex/img/top6.jpg';
	
	j=parseInt(Math.random()*list.length);
	j=(isNaN(j))?0:j;
	document.write("<img src='"+list[j]+"'>");
}

//SHOW/HIDE DIV. Call with: onclick="showstuff('id_of_element_to_show');"
function showstuff(boxid){
   document.getElementById(boxid).style.display="block";
}
function hidestuff(boxid){
   document.getElementById(boxid).style.display="none";
}