window.onerror = handleError;
function handleError(message, URI, line) {
	
       return true; 
}

var imagepath = "/images/gallery/big/"; 
var startimage = 1;	
var autoplay = 0; 
var switchspeed = 2;  
 

function easyimagetour(imagenr)
{

	var imagecount = document.getElementById("smallimages").getElementsByTagName("a");
	if (imagenr == "back") 
	{
		if (lastimage == 1)
		{
			imagenr=imagecount.length;
		}
		else
		{
			imagenr=parseInt(lastimage)-(1);
		}
		lastimage = imagenr;
	}
	else if (imagenr == "next")
	{
		if (lastimage == imagecount.length)
		{
			imagenr=1;
		}
		else
		{
			imagenr=parseInt(lastimage)+(1);
		} 
		lastimage = imagenr;
	}
	else
	{
		lastimage = imagenr;
	}
	
	document.getElementsByName("bigimage")[0].src = imagepath+'Tribu-Gallery-pic'+imagenr+'.jpg';
	
	for (var i=0;i<imagecount.length;i++)
	{
		document.getElementById("smallimages").getElementsByTagName("a")[i].className="";
	}
	document.getElementById("smallimages").getElementsByTagName("a")[imagenr-1].className ="active";
	document.getElementById("counter").innerHTML = imagenr;document.getElementById("description").innerHTML;
}
var timer; 
counter=0;
function start_easyimagetour()
{
	
	counter=counter+1;
	timer=setTimeout("start_easyimagetour()",1000);
	if (counter == switchspeed+1)
	{
		easyimagetour("next");
		restart_easyimagetour()
	}
}
function startstop_easyimagetour()
{
	if(document.getElementById("autoplay").innerHTML == "Stop Autoplay")
	{
		clearTimeout(timer);
		counter=0;
		document.getElementById("autoplay").innerHTML = "Start Autoplay"
	}
	else 
	{
		clearTimeout(timer);
		counter=0;
		start_easyimagetour();
		document.getElementById("autoplay").innerHTML = "Stop Autoplay";
	}
}
function restart_easyimagetour()
{
	clearTimeout(timer);
	counter=0;
	start_easyimagetour();
}
function stop_easyimagetour()
{
	clearTimeout(timer);
	counter=0;
}
window.onload=function()
{
	easyimagetour(startimage);
	if(autoplay!=0) 
	{
		start_easyimagetour(); 
		document.getElementById("autoplay").innerHTML = "Stop Autoplay"
	}
}


function toggle(e) {
    e.checked = !e.checked;    
}

function checkToggleDefault(e) {
    checkToggle(e, "selectAllForm");
}
function checkToggle(e, formName) {
    var cform = document[formName];
    if (e.checked) {      
        var len = cform.elements.length;
        var allchecked = true;
        for (var i = 0; i < len; i++) {
            var element = cform.elements[i];
            if (element.name.substring(0, 10) == "_rowSubmit" && !element.checked) {       
                allchecked = false;
            }
            cform.selectAll.checked = allchecked;            
        }
    } else {
        cform.selectAll.checked = false;
    }
}

function toggleAllDefault(e) {
    toggleAll(e, "selectAllForm");
}
function toggleAll(e, formName) {
    var cform = document[formName];
    var len = cform.elements.length;
    for (var i = 0; i < len; i++) {
        var element = cform.elements[i];
        if (element.name.substring(0, 10) == "_rowSubmit" && element.checked != e.checked) {
            toggle(element);
        }
    }
}

function selectAllDefault() {
    selectAll("selectAllForm");
}
function selectAll(formName) {
    var cform = document[formName];
    var len = cform.elements.length;
    for (var i = 0; i < len; i++) {
        var element = cform.elements[i];                   
        if ((element.name == "selectAll" || element.name.substring(0, 10) == "_rowSubmit") && !element.checked) {
            toggle(element);
        } 
    }     
}

function removeSelectedDefault() {
    removeSelected("selectAllForm");
}
function removeSelected(formName) {
    var cform = document[formName];
    cform.removeSelected.value = true;
    cform.submit();
}



function highlightRow(e,rowId){
    var currentClassName = document.getElementById(rowId).className;
    if (e.checked) {
        if (currentClassName == '' ) {
            document.getElementById(rowId).className = 'selected';
        } else if (currentClassName == 'alternate-row') {
            document.getElementById(rowId).className = 'alternate-rowSelected';
        }
    } else {
        if (currentClassName == 'selected') {
            document.getElementById(rowId).className = '';
        } else if (currentClassName == 'alternate-rowSelected') {
            document.getElementById(rowId).className = 'alternate-row';
        }
    }
}

function highlightAllRows(e, halfRowId, formName){
    var cform = document[formName];
    var len = cform.elements.length;
    for (var i = 0; i < len; i++) {
        var element = cform.elements[i];
        if (element.name.substring(0, 10) == "_rowSubmit") {
            highlightRow(e, halfRowId+element.name.substring(13));
        }
    }
}



function popUp(url, name, height, width) {
    popupWindow = window.open(url, name, 'location=no,scrollbars,width=' + width + ',height=' + height);
}
function popUpSmalltell(url, name) {
	
    popUp(url, name, '300', '450');
}
function popUpPrint(printserver, screen1) {
    popUpPrint(printserver, screen1, null, null);
}
function popUpPrint(printserver, screen1, screen2) {
    popUpPrint(printserver, screen1, screen2, null);
}
function popUpPrint(printserver, screen1, screen2, screen3) {
    if  (printserver == null) {
        printserver = "http://localhost:10080/";
    }

    if (screen1 != null) {
        screen1 = screen1.replace(/\:/g, "%3A");
        screen1 = screen1.replace(/\//g, "%2F");
        screen1 = screen1.replace(/\#/g, "%23");
        screen1 = screen1.replace(/\?/g, "%3F");
        screen1 = screen1.replace(/\=/g, "%3D");
        url = printserver + screen1;
        window.open(url, "screen1", 'location=no,statusbar=1,menubar=0,scrollbars,width=60,height=10,top=0,left=0');
        self.focus();

        if (screen2 != null) {
            screen2 = screen2.replace(/\:/g, "%3A");
            screen2 = screen2.replace(/\//g, "%2F");
            screen2 = screen2.replace(/\#/g, "%23");
            screen2 = screen2.replace(/\?/g, "%3F");
            screen2 = screen2.replace(/\=/g, "%3D");
            url = printserver + screen2;
            window.open(url, "screen2", 'location=no,statusbar=1,menubar=0,scrollbars,width=60,height=10,top=0,left=0');
            self.focus();

            if (screen3 != null) {
                screen3 = screen3.replace(/\:/g, "%3A");
                screen3 = screen3.replace(/\//g, "%2F");
                screen3 = screen3.replace(/\#/g, "%23");
                screen3 = screen3.replace(/\?/g, "%3F");
                screen3 = screen3.replace(/\=/g, "%3D");
                url = printserver + screen3;
                window.open(url, "screen13", 'location=no,statusbar=1,menubar=0,scrollbars,width=60,height=10,top=0,left=0');
                self.focus();
            }
        }
    }
}



function getStyleObject(objectId) {
    if (document.getElementById && document.getElementById(objectId)) {
        return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
        return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
        return document.layers[objectId];
    } else {
        return false;
    }
}
function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId);
    if (styleObject) {
        styleObject.visibility = newVisibility;
        return true;
    } else {
        return false;
    }
}


function confirmActionLink(msg, newLocation) {
    if (msg == null) {
        msg = "Are you sure you want to do this?";
    }
    var agree = confirm(msg);
    if (agree) {
        if (newLocation != null) location.replace(newLocation);
    }
}

function confirmActionFormLink(msg, formName) {
    if (msg == null) {
        msg = "Are you sure you want to do this?";
    }
    var agree = confirm(msg);
    if (agree) {
        if (formName != null) document.forms[formName].submit();
    } 
}


function ajaxUpdateArea(areaId, target, targetParams) {
    new Ajax.Updater(areaId, target, {parameters: targetParams});
}


function ajaxUpdateAreas(areaCsvString) {
    responseFunction = function(transport) {
        
    }
    var areaArray = areaCsvString.split(",");
    var numAreas = parseInt(areaArray.length / 3);
    for (var i = 0; i < numAreas * 3; i = i + 3) {
        new Ajax.Updater(areaArray[i], areaArray[i + 1], {parameters: areaArray[i + 2], onComplete: responseFunction,evalScripts: true });
    }
}


function ajaxUpdateAreaPeriodic(areaId, target, targetParams, interval) {
    new Ajax.PeriodicalUpdater(areaId, target, {parameters: targetParams, frequency: interval});
}


function ajaxSubmitRequestUpdateAreas(target, targetParams, areaCsvString) {
    updateFunction = function(transport) {
        ajaxUpdateAreas(areaCsvString);
    }
    new Ajax.Request(target, {
        parameters: targetParams,
        onComplete: updateFunction });
}


function submitFormInBackground(form, areaId, submitUrl) {
    submitFormDisableSubmits(form);
    updateFunction = function() {
        new Ajax.Updater(areaId, submitUrl);
    }
    new Ajax.Request(form.action, {
        parameters: form.serialize(true),
        onComplete: updateFunction });
}


function ajaxSubmitFormUpdateAreas(form, areaCsvString) {
    submitFormDisableSubmits($(form));
    updateFunction = function(transport) {
        var data = transport.responseText.evalJSON(true);
        if (data._ERROR_MESSAGE_LIST_ != undefined || data._ERROR_MESSAGE_ != undefined) {
            if(!$('content-messages')) {
               if($('app-navigation')){
                   $('app-navigation' ).insert({after: '<div id="content-messages"></div>'});
               }
            }
           $('content-messages').addClassName('errorMessage');
           $('content-messages' ).update(data._ERROR_MESSAGE_LIST_ + " " + data._ERROR_MESSAGE_);
           new Effect.Appear('content-messages',{duration: 0.5}); 
        }else {
        	if($('content-messages')) {
                $('content-messages').removeClassName('errorMessage');
                new Effect.Fade('content-messages',{duration: 0.0});   
            }
            ajaxUpdateAreas(areaCsvString);
        }
    }
    new Ajax.Request($(form).action, {
        parameters: $(form).serialize(true),
        onComplete: updateFunction });
}

function ajaxAutoCompleter(areaCsvString) {
    var areaArray = areaCsvString.split(",");
    var numAreas = parseInt(areaArray.length / 3);
    for (var i = 0; i < numAreas * 3; i = i + 3) {
	    var optionsDivId = areaArray[i] + "_autoCompleterOptions";
	    $(areaArray[i]).insert({after: '<div class="autocomplete"' + 'id=' + optionsDivId + '></div>'});
        new Ajax.Autocompleter($(areaArray[i]), optionsDivId, areaArray[i + 1], {parameters: areaArray[i + 2]});	
    }
}

function ajaxAutoCompleteDropDown(descriptionElement, hiddenElement, data, options) {
    var update = hiddenElement + "_autoCompleterOptions";
    $(descriptionElement).insert({after: '<div class="autocomplete"' + 'id=' + update + '></div>'});
    new Autocompleter.Local($(descriptionElement), update, $H(data), {autoSelect: options.autoSelect, frequency: options.frequency, minChars: options.minChars, choices: options.choices, partialSearch: options.partialSearch, partialChars: options.partialChars, ignoreCase: options.ignoreCase, fullSearch: options.fullSearch, afterUpdateElement: setKeyAsParameter});
    
    function setKeyAsParameter(text, li) {
        $(hiddenElement).value = li.id;
    }
}

function toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt){
    var container = $(areaId);
    var liElement = $(link).up('li');
    if(container.visible()){
        liElement.removeClassName('expanded');
        liElement.addClassName('collapsed');
        link.title = expandTxt;
    } else {
        liElement.removeClassName('collapsed');
        liElement.addClassName('expanded');
        link.title = collapseTxt;
    }
    Effect.toggle(container, 'appear');
}

function toggleScreenlet(link, areaId, expandTxt, collapseTxt){
    toggleCollapsiblePanel(link, areaId, expandTxt, collapseTxt);
    var container = $(areaId);
    var screenlet = container.up('div');
    if(container.visible()){
        var currentParam = screenlet.id + "_collapsed=false";
        var newParam = screenlet.id + "_collapsed=true";
    } else {
        var currentParam = screenlet.id + "_collapsed=true";
        var newParam = screenlet.id + "_collapsed=false";
    }
    var paginationMenus = $$('div.nav-pager');
    paginationMenus.each(function(menu) {
        if (menu) {
            var childElements = menu.getElementsByTagName('a');
            for (var i = 0; i < childElements.length; i++) {
                if (childElements[i].href.indexOf("http") == 0) {
                    childElements[i].href = replaceQueryParam(childElements[i].href, currentParam, newParam);
                }
            }
            childElements = menu.getElementsByTagName('select');
            for (i = 0; i < childElements.length; i++) {
                if (childElements[i].href.indexOf("location.href") >= 0) {
                    Element.extend(childElements[i]);
                    childElements[i].writeAttribute("onchange", replaceQueryParam(childElements[i].readAttribute("onchange"), currentParam, newParam));
                }
            }
        }
    });    
}

function ajaxInPlaceEditDisplayField(element, url, options) {
    new Ajax.InPlaceEditor($(element), url, options);
}


function replaceQueryParam(queryString, currentParam, newParam) {
    var result = queryString.replace(currentParam, newParam);
    if (result.indexOf(newParam) < 0) {
        if (result.indexOf("?") < 0) {
            result = result + "?" + newParam;
        } else if (result.endsWith("#")) {
            result = result.replace("#", "&" + newParam + "#");
        } else if (result.endsWith(";")) {
            result = result.replace(";", " + '&" + newParam + "';");
        } else {
            result = result + "&" + newParam;
        }
    }
    return result;
}

function submitFormDisableSubmits(form) {
    for (var i=0;i<form.length;i++) {
        var formel = form.elements[i];
        if (formel.type == "submit") {
            submitFormDisableButton(formel);
            var formName = form.name;
            var formelName = formel.name;
            var timeoutString = "submitFormEnableButtonByName('" + formName + "', '" + formelName + "')";
            var t = setTimeout(timeoutString, 1500);
        }
    }
}

function submitFormDisableButton(button) {
    if (button.form.action != null && button.form.action.length > 0) {
        button.disabled = true;
    }
    button.className = button.className + " disabled";
    button.value = button.value + "*";
}

function submitFormEnableButtonByName(formName, buttonName) {
    var form = document[formName];
    var button = form.elements[buttonName];
    submitFormEnableButton(button);
}
function submitFormEnableButton(button) {
    button.disabled = false;
    button.className = button.className.substring(0, button.className.length - " disabled".length);
    button.value = button.value.substring(0, button.value.length - 1);
}

var cssdropdown={
disappeardelay: 250,
dropdownindicator: '',
enablereveal: [true, 5], 
enableiframeshim: 1, 


dropmenuobj: null, asscmenuitem: null, domsupport: document.all || document.getElementById, standardbody: null, iframeshimadded: false, revealtimers: {},

getposOffset:function(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
},

css:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
	else if (action=="remove")
		el.className=el.className.replace(needle, "")
	else if (action=="add" && !needle.test(el.className))
		el.className+=" "+targetclass
},

showmenu:function(dropmenu, e){
	if (this.enablereveal[0]){
		if (!dropmenu._trueheight || dropmenu._trueheight<10)
			dropmenu._trueheight=dropmenu.offsetHeight
		clearTimeout(this.revealtimers[dropmenu.id])
		dropmenu.style.height=dropmenu._curheight=0
		dropmenu.style.overflow="hidden"
		dropmenu.style.visibility="visible"
		this.revealtimers[dropmenu.id]=setInterval(function(){cssdropdown.revealmenu(dropmenu)}, 10)
	}
	else{
		dropmenu.style.visibility="visible"
	}
	this.css(this.asscmenuitem, "selected", "add")
},

revealmenu:function(dropmenu, dir){
	var curH=dropmenu._curheight, maxH=dropmenu._trueheight, steps=this.enablereveal[1]
	if (curH<maxH){
		var newH=Math.min(curH, maxH)
		dropmenu.style.height=newH+"px"
		dropmenu._curheight= newH + Math.round((maxH-newH)/steps) + 1
	}
	else{ 
		dropmenu.style.height="auto"
		dropmenu.style.overflow="hidden"
		clearInterval(this.revealtimers[dropmenu.id])
	}
},

clearbrowseredge:function(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=document.all && !window.opera? this.standardbody.scrollLeft+this.standardbody.clientWidth-15 : window.pageXOffset+window.innerWidth-15
		var dropmenuW=this.dropmenuobj.offsetWidth
		if (windowedge-this.dropmenuobj.x < dropmenuW) 
			edgeoffset=dropmenuW-obj.offsetWidth
	}
	else{
		var topedge=document.all && !window.opera? this.standardbody.scrollTop : window.pageYOffset
		var windowedge=document.all && !window.opera? this.standardbody.scrollTop+this.standardbody.clientHeight-15 : window.pageYOffset+window.innerHeight-18
		var dropmenuH=this.dropmenuobj._trueheight
		if (windowedge-this.dropmenuobj.y < dropmenuH){ 
			edgeoffset=dropmenuH+obj.offsetHeight
			if ((this.dropmenuobj.y-topedge)<dropmenuH) 
				edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
		}
	}
	return edgeoffset
},

dropit:function(obj, e, dropmenuID){
	if (this.dropmenuobj!=null) 
		this.hidemenu()
	this.clearhidemenu()
	this.dropmenuobj=document.getElementById(dropmenuID) 
	this.asscmenuitem=obj 
	this.showmenu(this.dropmenuobj, e)
	this.dropmenuobj.x=this.getposOffset(obj, "left")
	this.dropmenuobj.y=this.getposOffset(obj, "top")
	this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
	this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
	this.positionshim() 
},

positionshim:function(){ 
	if (this.iframeshimadded){
		if (this.dropmenuobj.style.visibility=="visible"){
			this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
			this.shimobject.style.height=this.dropmenuobj._trueheight+"px"
			this.shimobject.style.left=parseInt(this.dropmenuobj.style.left)+"px"
			this.shimobject.style.top=parseInt(this.dropmenuobj.style.top)+"px"
			this.shimobject.style.display="block"
		}
	}
},

hideshim:function(){
	if (this.iframeshimadded)
		this.shimobject.style.display='none'
},

isContained:function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
},

dynamichide:function(m, e){
	if (!this.isContained(m, e)){
		this.delayhidemenu()
	}
},

delayhidemenu:function(){
	this.delayhide=setTimeout("cssdropdown.hidemenu()", this.disappeardelay)
},

hidemenu:function(){
	this.css(this.asscmenuitem, "selected", "remove")
	this.dropmenuobj.style.visibility='hidden'
	this.dropmenuobj.style.left=this.dropmenuobj.style.top="-1000px"
	this.hideshim()
},

clearhidemenu:function(){
	if (this.delayhide!="undefined")
		clearTimeout(this.delayhide)
},

addEvent:function(target, functionref, tasktype){
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false);
	else if (target.attachEvent)
		target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)});
},

startchrome:function(){
	if (!this.domsupport)
		return
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	for (var ids=0; ids<arguments.length; ids++){
		var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
		for (var i=0; i<menuitems.length; i++){
			if (menuitems[i].getAttribute("rel")){
				var relvalue=menuitems[i].getAttribute("rel")
				var asscdropdownmenu=document.getElementById(relvalue)
				this.addEvent(asscdropdownmenu, function(){cssdropdown.clearhidemenu()}, "mouseover")
				this.addEvent(asscdropdownmenu, function(e){cssdropdown.dynamichide(this, e)}, "mouseout")
				this.addEvent(asscdropdownmenu, function(){cssdropdown.delayhidemenu()}, "click")
				try{
					menuitems[i].innerHTML=menuitems[i].innerHTML+" "+this.dropdownindicator
				}catch(e){}
				this.addEvent(menuitems[i], function(e){
					if (!cssdropdown.isContained(this, e)){
						var evtobj=window.event || e
						cssdropdown.dropit(this, evtobj, this.getAttribute("rel"))
					}
				}, "mouseover")
				this.addEvent(menuitems[i], function(e){cssdropdown.dynamichide(this, e)}, "mouseout") 
				this.addEvent(menuitems[i], function(){cssdropdown.delayhidemenu()}, "click")
			}
		} 
	} 
	if (this.enableiframeshim && document.all && !window.XDomainRequest && !this.iframeshimadded){ 
		document.write('<IFRAME id="iframeshim" src="about:blank" frameBorder="0" scrolling="no" style="left:0; top:0; position:absolute; display:none;z-index:90; background: transparent;"></IFRAME>')
		this.shimobject=document.getElementById("iframeshim") 
		this.shimobject.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
		this.iframeshimadded=true
	}
} 

}



startList = function()
{
    if (document.all&&document.getElementById) {
       
       
        obj = document.getElementById("currency");
		 
        if (obj) {
            obj.onmouseover=function()
            {
				
                this.className+=" over";
				 
            }
            obj.onmouseout=function()
            {
				
				
                this.className=this.className.replace(" over", "");
				
            }
        }
       

    }
    if (document.getElementById) {
        
       
       
       
        
    }
}
window.onload=startList;
function TextScroll(scrollname, div_name, up_name, down_name)
{

 this.div_name = div_name;
 this.name = scrollname;
 this.scrollCursor = 0;
 this.speed = 5;
 this.timeoutID = 0;
 this.div_obj = null;
 this.up_name = up_name;
 this.dn_name = down_name;

{
     if (document.getElementById) {
         div_obj = document.getElementById(this.div_name);
         if (div_obj) {
             this.div_obj = div_obj;
             this.div_obj.style.overflow = 'hidden';
         }
         div_up_obj = document.getElementById(this.up_name);
         div_dn_obj = document.getElementById(this.dn_name);
			
			 
         if (div_up_obj && div_dn_obj) {
			
			 div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
         }
     }
 }

this.stopScroll = function() {
     clearTimeout(this.timeoutID);
 }

this.scrollUp = function() {

     if (this.div_obj) {
         this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
         this.div_obj.scrollTop = this.scrollCursor;
         this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
     }
 }
	
	

this.scrollDown = function() {
     if (this.div_obj) {
         this.scrollCursor += this.speed;
         this.div_obj.scrollTop = this.scrollCursor;
         this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
     }
 }

this.resetScroll = function() {
     if (this.div_obj) {
         this.div_obj.scrollTop = 0;
         this.scrollCursor = 0;
     }
 }
}
var NUM_CENTYEAR = 30;
var BUL_TIMECOMPONENT = false;
var BUL_YEARSCROLL = true;

var calendars = [];
var lookups = [];

var RE_NUM = /^\-?\d+$/;

var webPath = "";

var NS4 = (navigator.appName.indexOf("Netscape")>=0 && !document.getElementById)? true : false;
var IE4 = (document.all && !document.getElementById)? true : false;
var IE5 = (document.getElementById && document.all)? true : false;
var NS6 = (document.getElementById && navigator.appName.indexOf("Netscape")>=0 )? true: false;
var mx, my;

function moveobj(evt) {
 if (NS4 || NS6) {
 mx=evt.screenX;
 	my=evt.screenY;
 } else if (IE5 || IE4) {
 	mx=event.screenX;
 	my=event.screenY;
 }
}

if(NS4)document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=moveobj;

function call_cal(target, datetime) {   
 var cal3 = new calendar1(target);
 cal3.year_scroll = true;
 cal3.time_comp = true;    
 cal3.popup(datetime);
}

function call_cal_notime(target, datetime) {   
 var cal3 = new calendar1(target);
 cal3.year_scroll = true;
 cal3.time_comp = false;    
 cal3.popup(datetime);
}

function calendar1(obj_target) {

	this.gen_date = cal_gen_date1;
	this.gen_time = cal_gen_time1;
	this.gen_tsmp = cal_gen_tsmp1;
	this.prs_date = cal_prs_date1;
	this.prs_time = cal_prs_time1;
	this.prs_tsmp = cal_prs_tsmp1;
	this.popup    = cal_popup1;

	if (!obj_target)
		return cal_error("Error calling the calendar: no target control specified");
	if (obj_target.value == null)
		return cal_error("Error calling the calendar: parameter specified is not valid tardet control");
	this.target = obj_target;	
	this.time_comp = BUL_TIMECOMPONENT;
	this.year_scroll = BUL_YEARSCROLL;
	
	this.id = calendars.length;
	calendars[this.id] = this;
}

function cal_popup1 (str_datetime) {
	this.dt_current = this.prs_tsmp(str_datetime ? str_datetime : this.target.value);
	if (!this.dt_current) return;
	
	var obj_calwindow = window.open('/images/' +
		'calendar.html?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
		'Calendar', 'width=150,height='+(this.time_comp ? 220 : 235)+
		',status=no,resizable=yes,top='+my+',left='+mx+',dependent=yes,alwaysRaised=yes'
	);
	obj_calwindow.opener = window;
	obj_calwindow.focus();
}

function cal_gen_tsmp1 (dt_datetime) {
	return(this.gen_date(dt_datetime) + ' ' + this.gen_time(dt_datetime));
}

function cal_gen_date1 (dt_datetime) {
 return (
     dt_datetime.getFullYear() + "-"
     + (dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "-"
     + (dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate()
	);
}
function cal_gen_time1 (dt_datetime) {
	return (
		(dt_datetime.getHours() < 10 ? '0' : '') + dt_datetime.getHours() + ":"
		+ (dt_datetime.getMinutes() < 10 ? '0' : '') + (dt_datetime.getMinutes()) + ":"
		+ (dt_datetime.getSeconds() < 10 ? '0' : '') + (dt_datetime.getSeconds()) + "."
		+ (dt_datetime.getMilliseconds())
	);
}

function cal_prs_tsmp1 (str_datetime) {
	if (!str_datetime)
		return (new Date());

	if (RE_NUM.exec(str_datetime))
		return new Date(str_datetime);
		
	var arr_datetime = str_datetime.split(' ');
	return this.prs_time(arr_datetime[1], this.prs_date(arr_datetime[0]));
}

function cal_prs_date1 (str_date) {

	var arr_date = str_date.split('-');

	if (arr_date.length != 3) return cal_error ("Invalid date format: '" + str_date + "'.\nFormat accepted is dd-mm-yyyy.");
	if (!arr_date[2]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo day of month value can be found.");
	if (!RE_NUM.exec(arr_date[2])) return cal_error ("Invalid day of month value: '" + arr_date[2] + "'.\nAllowed values are unsigned integers.");
	if (!arr_date[1]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo month value can be found.");
	if (!RE_NUM.exec(arr_date[1])) return cal_error ("Invalid month value: '" + arr_date[1] + "'.\nAllowed values are unsigned integers.");
	if (!arr_date[0]) return cal_error ("Invalid date format: '" + str_date + "'.\nNo year value can be found.");
	if (!RE_NUM.exec(arr_date[0])) return cal_error ("Invalid year value: '" + arr_date[0] + "'.\nAllowed values are unsigned integers.");

	var dt_date = new Date();
	dt_date.setDate(1);

	if (arr_date[1] < 1 || arr_date[1] > 12) return cal_error ("Invalid month value: '" + arr_date[1] + "'.\nAllowed range is 01-12.");
	dt_date.setMonth(arr_date[1]-1);
	 
	if (arr_date[0] < 100) arr_date[2] = Number(arr_date[0]) + (arr_date[0] < NUM_CENTYEAR ? 2000 : 1900);
	dt_date.setFullYear(arr_date[0]);

	var dt_numdays = new Date(arr_date[0], arr_date[1], 0);
	dt_date.setDate(arr_date[2]);
	if (dt_date.getMonth() != (arr_date[1]-1)) return cal_error ("Invalid day of month value: '" + arr_date[2] + "'.\nAllowed range is 01-"+dt_numdays.getDate()+".");

	return (dt_date)
}

function cal_prs_time1 (str_time, dt_date) {

	if (!dt_date) return null;
	var arr_time = String(str_time ? str_time : '').split(':');

	if (!arr_time[0]) dt_date.setHours(0);
	else if (RE_NUM.exec(arr_time[0])) 
		if (arr_time[0] < 24) dt_date.setHours(arr_time[0]);
		else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed range is 00-23.");
	else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed values are unsigned integers.");
	
	if (!arr_time[1]) dt_date.setMinutes(0);
	else if (RE_NUM.exec(arr_time[1]))
		if (arr_time[1] < 60) dt_date.setMinutes(arr_time[1]);
		else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed range is 00-59.");
	else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed values are unsigned integers.");

 var arr_sec = String(arr_time[2] ? arr_time[2] : '').split('.');
 
	if (!arr_sec[0]) dt_date.setSeconds(0);
	else if (RE_NUM.exec(arr_sec[0]))
		if (arr_sec[0] < 60) dt_date.setSeconds(arr_sec[0]);
		else return cal_error ("Invalid seconds value: '" + arr_sec[0] + "'.\nAllowed range is 00-59.");
	else return cal_error ("Invalid seconds value: '" + arr_sec[0] + "'.\nAllowed values are unsigned integers.");
	
	if (!arr_sec[1]) dt_date.setMilliseconds(0);
	else if (RE_NUM.exec(arr_sec[1]))
	    if (arr_sec[1] < 1000) dt_date.setMilliseconds(arr_sec[1]);
	    else return cal_error ("Invalid milliseconds valus: '" + arr_sec[1] + "'.\nAllowed range is 00-999.");
	else return cal_error ("Invalid milliseconds value: '" + arr_sec[1] + "'.\nAllowed values are unsigned integers.");
	
	return dt_date;
}

function cal_error (str_message) {
	alert (str_message);
	return null;
}

var offsetfrommouse=[15,25]; 
var displayduration=0; 

var defaultimageheight = 40;
var defaultimagewidth = 40;

var timer;

function gettrailobj(){
if (document.getElementById)
return document.getElementById("preview_div").style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("preview_div")
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : parent.document.body
}


function hidetrail(){	
	gettrailobj().display= "none";
	document.onmousemove=""
	gettrailobj().left="-500px"
	clearTimeout(timer);
}

function showtrail(imagename,title,width,height,sizetxt){
	i = imagename
	t = title
	w = width
	h = height
	s = sizetxt
	timer = setTimeout("show('"+i+"',t,w,h,s);",1);
}
function show(imagename,title,width,height,sizetxt){
 
    var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth - offsetfrommouse[0]
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)
	
	if( (navigator.userAgent.indexOf("Konqueror")==-1  || navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Crome")!=-1 || (navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1)) && (docwidth>650 && docheight>500)) {
		( width == 0 ) ? width = defaultimagewidth: '';
		( height == 0 ) ? height = defaultimageheight: '';
		
		width+=30
		height+=250
		defaultimageheight = height
		defaultimagewidth = width
		
		document.onmousemove=followmouse; 

		
	    newHTML = '<div class="border_preview" style="width:'+  width +'px;  height:'+  height +'px;"><div id="loader_container"><div id="loader"><div align="center">Loading image preview...</div><div id="loader_bg"><div id="progress"> </div></div></div></div>';
		newHTML = newHTML + '<h2 class="title_h2">' + ' '+title +'</h2>'
   		newHTML = newHTML + '<div class="preview_temp_load" style="text-align:center;"><table align="center" width="100%"><tr><td align="center" ><img onload="javascript:remove_loading();" src="' + imagename + '" border="0" width="300px" height="300px" align="center"></td></tr></table></div>';
		newHTML = newHTML + '</div>'; 
		
		
		if(navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1 ){
			newHTML = newHTML+'<iframe src="about:blank" scrolling="no" frameborder="0" width="'+width+'" height="'+height+'"></iframe>';
		}		

		gettrailobjnostyle().innerHTML = newHTML;
		gettrailobj().display="block";
	} 
}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; 
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

}

var t_id = setInterval(animate,20);
var pos=0;
var dir=2;
var len=0;

function animate()
{
var elem = document.getElementById('progress');
if(elem != null) {
if (pos==0) len += dir;
if (len>32 || pos>79) pos += dir;
if (pos>79) len -= dir;
if (pos>79 && len==0) pos=0;
elem.style.left = pos;
elem.style.width = len;
}
}

function remove_loading() {
this.clearInterval(t_id);
var targelem = document.getElementById('loader_container');
targelem.style.display='none';
targelem.style.visibility='hidden';
var t_id = setInterval(animate,60);
}

function displayinfo2() {
	document.getElementById("info_pop").style.display = 'none' 
	document.getElementById("info_pop").style.display = '';
}
function displayinfo_long() {
	document.getElementById("info_long").style.display = 'none' 
	document.getElementById("info_long").style.display = '';
}


function showMeTell() {
	document.getElementById("theLayer").style.display = 'none' 
	document.getElementById("theLayer").style.display = '';
}
function showMe_hide() {
	
	document.getElementById("theLayer").style.display = '' 
	document.getElementById("theLayer").style.display = 'none';
}

function ValidateContactForm(tellafriend)
{	
	if (document.tellafriend.yourName.value == "")
    {
       alert("Please enter your name.");
       document.tellafriend.yourName.focus();
        return false;
    }
   
	if (document.tellafriend.sendFrom.value == "")
    {
       alert("Please enter your e-mail address.");
       document.tellafriend.sendFrom.focus();
        return false;
    }
	if (document.tellafriend.sendFrom.value.indexOf("@", 0) < 0)
    {
        alert("Please enter a valid e-mail address.");
        document.tellafriend.sendFrom.focus();
        return false;
    }
    if (document.tellafriend.sendFrom.value.indexOf(".", 0) < 0)
    {
        alert("Please enter a valid e-mail address.");
        document.tellafriend.sendFrom.focus();
        return false;
    }
	if (document.tellafriend.friendName.value == "")
    {
       alert("Please enter your friends name");
       document.tellafriend.friendName.focus();
        return false;
    }
	if (document.tellafriend.sendTo.value == "")
    {
       alert("Please enter your e-mail address.");
       document.tellafriend.sendTo.focus();
        return false;
    }
	if (document.tellafriend.sendTo.value.indexOf("@", 0) < 0)
    {
        alert("Please enter a valid e-mail address.");
        document.tellafriend.sendTo.focus();
        return false;
    }
    if (document.tellafriend.sendTo.value.indexOf(".", 0) < 0)
    {
        alert("Please enter a valid e-mail address.");
        document.tellafriend.sendTo.focus();
        return false;
    }
	
	if (document.tellafriend.message.value == "")
    {
       alert("Please enter your message.");
       document.tellafriend.message.focus();
        return false;
    }
	
	
	
	return true;
	}

function startup() {
    var canvas = document.getElementById('home_bg.jpg');
    var ctx = canvas.getContext('2d');
    var img = new Image();
    img.src = 'player.gif';
    img.onload = function() {
            ctx.translate(185, 185);
            ctx.rotate(90 * Math.PI / 180);
            ctx.drawImage(img, 0, 0, 64, 120);
    }
}


function makeSelected(abc) {
	var choice = document.singlePair.FTPairSingle;


for (i = 0; i < choice.length; i++) {
	  if ( choice[i].checked = true ) 
	   choice[i].checked = false; 
	 }

}



//customAlertBox.js

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Steve Chipman | http://slayeroffice.com/ */

// constants to define the title of the alert and button text.
var ALERT_TITLE = "Tribu";
var ALERT_BUTTON_TEXT = "Close";

// over-ride the alert method only if this a newer browser.
// Older browser will see standard alerts
if(document.getElementById) {
  window.alert = function(txt) {
    createCustomAlert(txt);
  }
}

function createCustomAlert(txt) {
  // shortcut reference to the document object
  d = document;

  // if the modalContainer object already exists in the DOM, bail out.
  if(d.getElementById("modalContainer")) return;

  // create the modalContainer div as a child of the BODY element
  mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
  mObj.id = "modalContainer";
   // make sure its as tall as it needs to be to overlay all the content on the page
  mObj.style.height = document.documentElement.scrollHeight + "px";

  // create the DIV that will be the alert 
  alertObj = mObj.appendChild(d.createElement("div"));
  alertObj.id = "alertBox";
  // MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
  if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
  // center the alert box
  alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";

  // create an H1 element as the title bar
  h1 = alertObj.appendChild(d.createElement("h1"));
  h1.appendChild(d.createTextNode(ALERT_TITLE));

  // create a paragraph element to contain the txt argument
  msg = alertObj.appendChild(d.createElement("p"));
  msg.innerHTML = txt;
  
  // create an anchor element to use as the confirmation button.
  btn = alertObj.appendChild(d.createElement("a"));
  btn.id = "closeBtn";
  btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
  btn.href = "#";
  // set up the onclick event to remove the alert when the anchor is clicked
  btn.onclick = function() { removeCustomAlert();return false; }
}

// removes the custom alert from the DOM
function removeCustomAlert() {
  document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}



