/**
 * @author Jazzboy
 */

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);
  }
}

function addlanguagetolink(language){

	var y = document.getElementsByTagName("a");
	for (var i = 0; i < y.length; i++) {
		if (y[i].getAttribute("href") != undefined) {
			if (y[i].getAttribute("href").indexOf("javascript") == -1) {
				if (!(y[i].orighref)) {
					y[i].setAttribute(("orighref"), y[i].getAttribute("href"));
					
				}
				else {
					y[i].setAttribute("href", "orighref");
				}
				
				var linkstring = y[i].getAttribute("orighref");
				if (linkstring.indexOf("=") != -1) {
					y[i].setAttribute("href", y[i].href + "&lang=" + language);
				}
				else {
					if (linkstring.indexOf("#") == -1) {
						y[i].setAttribute("href", y[i].href + "?lang=" + language);
					}
				}
			}
		}
	}
}

function changelanguage(language){
	window.location = "index.php5?lang=" + language ;

	
}



