
// fading effect for the photo album, for IE only, todo: firefox
	function txFade(){
		
		if(/MSIE/.test(navigator.userAgent)) {
			var elem = document.getElementById('photoimage');
			if (elem){
				var fElem = new Fade(elem.id);
				
								
				fElem.basket = [{backgroundImage:'url('+url_base+'/images/iAlbum.jpg)'},{backgroundImage: 'url('+url_base+'/images/iAlbum2.jpg)'},{backgroundImage: 'url('+url_base+'/images/iAlbum3.jpg)'},{backgroundImage:'url('+url_base+'/images/iAlbum4.jpg)'}];
				fElem.init('0.3','1');
				fElem.play(fElem);
			}
		}
		
	}

	function Fade(id){
		this.element = document.getElementById(id);
		this.basket = Array();
		this.ayyash = "ayyash";
		this.init = function(dur,ol){
			this.element.style.filter = 'progid:DXImageTransform.Microsoft.Fade(duration='+dur+',overlap='+ol+')';
			this.filter = this.element.filters[this.element.filters.length-1];
			// set first basket style
			this.setStyle(this.basket[0]);
			this.count = 0;
		}
		
		this.play = function(elem){
			// apply filter
			this.filter.apply();
			// apply transition to the next item
			this.setStyle(this.basket[this.count++]);
			if (this.count >= this.basket.length) this.count = 0;
			// play filter
			this.filter.play();
			// do again
			setTimeout(function(){elem.play(elem);},3000);
			
		}
		
		this.setStyle = function(style){
			for (var name in style)
		 		this.element.style[camelize(name)] = style[name];
			
		}
		
	}
	
	
	
	function camelize(name){ 
		var oStringList = name.split('-'); 
		if (oStringList.length == 1) return oStringList[0]; 
		var camelizedString = name.indexOf('-') == 0 ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0]; 
		for (var i = 1, len = oStringList.length; i < len; i++) { 
			var s = oStringList[i]; 
			camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
		}
		return camelizedString;
	}
	
	/*
	function getStyle(element, style) {
   
		var value = element.style[style.camelize()];
		if (!value) {
		  if (document.defaultView && document.defaultView.getComputedStyle) {
			var css = document.defaultView.getComputedStyle(element, null);
			value = css ? css.getPropertyValue(style) : null;
		  } else if (element.currentStyle) {
			value = element.currentStyle[camelize(style)];
		  }
		}
	
		return value;
  }

	function setStyle(element, style) {
		for (var name in style)
		  element.style[camelize(name)] = style[name];
	}
	

	function getOpacity(element){  
	  var opacity;
	  if (opacity = getStyle(element, 'opacity'))  
		return parseFloat(opacity);  
	  if (opacity = (getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))  
		if(opacity[1]) return parseFloat(opacity[1]) / 100;  
	  return 1.0;  
	}
	
	function setOpacity(element, value){  
	  element= $(element);  
	  if (value == 1){
		setStyle(element, { opacity: 
		  (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 
		  0.999999 : null });
		if(/MSIE/.test(navigator.userAgent))  
		  Element.setStyle(element, {filter: getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'')});  
	  } else {  
		if(value < 0.00001) value = 0;  
		setStyle(element, {opacity: value});
		if(/MSIE/.test(navigator.userAgent))  
		 setStyle(element, 
		   { filter: getStyle(element,'filter').replace(/alpha\([^\)]*\)/gi,'') +
					 'alpha(opacity='+value*100+')' });  
	  }   
	}  
	
	function Fade(element) {
	  var oldOpacity = element.style.opacity || '';
	  // loop and change opacity from 1 to 0 gradually, and increase the other layer opacity
	  var from =  getOpacity(element) || 1.0;
	  var to =    0.0;
	  
	  afterFinishInternal: function(effect) { with(Element) { 
		if(effect.options.to!=0) return;
		hide(effect.element);
		setStyle(effect.element, {opacity: oldOpacity}); }}
	  }, arguments[1] || {});
	  return new Effect.Opacity(element,options);
	}
	function afterFinishInternal(effect){
		
	}
	
	function getInlineOpacity (element){  
	  return element.style.opacity || '';
	}  
*/