//<!--
function close_window(url) {
	if (window.opener)
		window.close();
	else
		location = url; // Fix me: It sucks
}
// Dummy wrapper for window.open
function open_window(uri) {
	window.open(uri, 'cuscofree', 'width=600, height=600, scrollbars=yes, left=100,dependent=1,resizable=1');
	return false;
}
function delete_element() {
	frms = document.getElementById('frm');
	if (!frms || !frms.action || !confirm_msg()) return false;
	frms.action.value = 'remove';
	frms.submit();
	return true;
}
function delete_elements() {
	frms = document.getElementById('frm');
	if (!confirm_msg('Desea eliminar realmente estos elementos?')) return false;
	frms.action.value = 'removeall';
	frms.submit();
	return true;
}
function confirm_msg(msg) {
	if (!msg) msg = 'Desea eliminar realmente este elemento?';
	return confirm(msg);
}
function delete_image(image) {
	if(confirm_msg('Desea eliminar realmente esta imagen?')){
		cadena = new String(image);
		cadena.replace(/\..*/,'');
		eval("document.getElementById('"+cadena+"').style.display = 'none'");
		document.getElementById('msgtrash').style.display = 'block';
		document.getElementById('trash').value += image + ',';
	}
}

showPan = function (chk) {
	pan = document.getElementById('filespan');
	pan.style.display = (chk.checked ? 'block' : 'none');
}

function more_dests(){			        
	var obj = document.getElementById('other_destinations');
         obj.style.display = 'block'		 
	var dest = document.getElementById('more_destinations');         
	dest.style.display = 'none'
}
/*  highlight */
function highlight(){	
	
	this.images = new Array();	
	
	this.botones = new Object();	
	
	this.links = new Object();	
	
	this.container;	this.navegation;	
	
	this.counterpreloader = 0;	
	
	this.currentimage = 0;	
	
	this.counter = 0;	
	
	this.rotator;	
	
	this.time;	
	
	this.slider = function(cont,nav,t){		
	
		var root = this;		
		
		this.time = t * 1000;		
		
		this.container = document.getElementById(cont);		
		
		this.botones = this.container.getElementsByTagName('p');		
		
		var total = this.container.getElementsByTagName('img');		
		
		for(var i=0; i<total.length; i++){			
		
			this.images[i] = total[i];			
			
			var img = new Image();			
			
			img.z = i;			
			
			img.onload = function(){				
			
				root.images[this.z].style.zIndex = this.z + 1;				
				
				root.counterpreloader+= 1;				
				
				if(root.counterpreloader >= total.length){					
				
					root.images[0].style.zIndex = total.length + 1;					
					
					root.fadeElement(root.images[0],true);					
					
					root.counterpreloader = 0;					
					
					root.swithImage(root.currentimage);					
					
					root.container.style.background = "white";					
					
					//root.loadButtons(nav);				
					
				}			
				
			}			
			
			img.src = this.images[i].src;		
			
		}	
		
	}	
	/*	this.loadButtons = function(nav){		this.navegation = document.getElementById(nav);		this.links = this.navegation.getElementsByTagName('a');		var root = this;		for(var i=0; i<this.botones.length; i++){			this.links[i].onclick = function(){				root.chageItem(this.parentNode);			}		}	}	*/		
	
	this.fadeElement = function(element,fadetype){		
	
		if(fadetype){			
		
			var fadenumber = 0;		
			
		}else{			
		
			var fadenumber = 10;		
			
		}		
		
		var fadeopacity;		
		
		var fadealpha;		
		
		var showcontainer = setInterval(fade,100);		
		
		function fade(){			
		
			if(fadetype){				
				
				fadenumber+= 2;				
				
				fadeopacity = fadenumber / 10;				
				
				fadealpha = fadenumber * 10;				
				
				if(fadenumber >= 10){					
				
					clearInterval(showcontainer);					
					
					element.style.opacity = '1';					
					
					element.style.filter = 'alpha(opacity=100)';				
					
				}else{					
				
					element.style.opacity = fadeopacity;					
					
					element.style.filter = 'alpha(opacity='+fadealpha+')';				
					
				}			
				
			}else{				
			
				fadenumber-= 2;				
				
				fadeopacity = fadenumber / 10;				
				
				fadealpha = fadenumber * 10;				
				
				if(fadenumber <= 0){					
				
					clearInterval(showcontainer);					
					
					element.style.opacity = '0';					
					
					element.style.filter = 'alpha(opacity=0)';				
					
				}else{					
				
					element.style.opacity = fadeopacity;					
					
					element.style.filter = 'alpha(opacity='+fadealpha+')';				
					
				}			
				
			}		
			
		}	
		
	}	
	
	this.swithImage = function(current){		
	
		this.currentimage = current;		
		
		clearTimeout(this.rotator);		
		
		this.rotator = setTimeout(swithImg,this.time);		
		
		var root = this;		
		
		function swithImg (){			
		
			if(root.currentimage >= root.images.length - 1){				
			
				root.fadeElement(root.images[root.currentimage],false);				
				
				root.images[root.currentimage].style.zIndex = root.currentimage;				
				
				root.fadeElement(root.images[0],true);				
				
				root.images[0].style.zIndex = root.images.length + 1;				
				
				root.tagMake(0);				
				
				root.currentimage = root.images.length;			
				
			}else{				
			
				root.fadeElement(root.images[root.currentimage],false);				
				
				root.images[root.currentimage].style.zIndex = root.currentimage;				
				
				root.fadeElement(root.images[root.currentimage + 1],true);				
				
				root.images[root.currentimage + 1].style.zIndex = root.images.length + 1;				
				
				root.tagMake(root.currentimage + 1);			
				
			}			
			
			if(root.currentimage >= root.images.length){				
			
				root.currentimage = 0;			
				
			}else{				
			
				root.currentimage++;			
				
			}			
			
			root.rotator = setTimeout(swithImg,root.time);		
		
		}	
		
	}	
	
	this.chageItem = function(element){		
	
		if(element != this.botones[this.currentimage]){			
		
			for(var i=0; i<this.botones.length; i++){				
			
				if(element == this.botones[i]){					
				
					this.tagMake(i);					
					
					this.fadeElement(this.images[this.currentimage],false);					
					
					this.images[this.currentimage].style.zIndex = this.currentimage;					
					
					this.fadeElement(this.images[i],true);					
					
					this.images[i].style.zIndex = this.images.length + 1;					
					
					this.swithImage(i);				
					
				
				}			
				
			}		
			
		}	
		
	}	
	
	this.tagMake = function(num){		
	
		for(var i=0; i<this.botones.length; i++){			
		
			this.botones[i].className = "";		
			
		}		
		
		this.botones[num].className = "selected";	
		
	}	
	
}
var sweet = new highlight();

//-->
