//******************* EDWIN ************************//
//*      Funktionsdatei von Q2E				       *//
//**************************************************//
//   copyright, Feb. 2009, office@q2e.at   //


function ch_color(id,color){
	obj = document.getElementById(id);
	obj.style.color = color;
	}

function ch_border(id,borderstring){
	obj = document.getElementById(id);
	obj.style.border = borderstring;
	}
	
	


/*
objID is the ID of the object you want to fade
TargetAlpha is the % of opacity you want as result
steps is the amount of steps of the fade in 1/20 seconds (this controls the speed of the fade)

this will fade in or out depending on the value of TargetAlpha
*/
function Fade(objID,CurrentAlpha,TargetAlpha,steps,addition_obtion){
  
            var obj = document.getElementById(objID);
            var add_obtion ="addition_obtion";
			
			if(add_obtion = 'show_div'){
				//Show_div(objID);
				//add_obtion = '';
			  }
			  
            CurrentAlpha = parseInt(CurrentAlpha);
            if (isNaN(CurrentAlpha)){
                  CurrentAlpha = parseInt(obj.style.opacity*100);
                  if (isNaN(CurrentAlpha))CurrentAlpha=100;
            }
            
            var DeltaAlpha=parseInt((CurrentAlpha-TargetAlpha)/steps);
            var NewAlpha = CurrentAlpha - DeltaAlpha;
            
            obj.style.opacity = (NewAlpha / 100);
            obj.style.MozOpacity = obj.style.opacity;
            obj.style.filter = 'alpha(opacity='+NewAlpha+')';
            
            if (steps>1){
                  setTimeout('Fade("'+objID+'",'+NewAlpha+','+TargetAlpha+','+(steps-1)+',"'+add_obtion+'")', 50);
            }
			
			
			if(steps == 1 && add_obtion == 'hide_div'){
				//Show_div(objID);
			  }
	
}

function Hide_div(objID){
	
			var obj = document.getElementById(objID);
			obj.style.visibility = "hidden";
			obj.style.display = "none";
}
	
function Show_div(objID){
	
			var obj = document.getElementById(objID);
			obj.style.visibility = "visible";
			obj.style.display = "inline";
}





//Flash text 

//hex=255; // Initial color value.

function fadetext(div_id,hex){ 

var div_id_in=div_id;
if(hex>0) { //If color is not black yet
hex-=11; // increase color darkness
//hex2-=11;
//hex3-=11;
//alert(div_id);
document.getElementById(div_id).style.color="rgb("+hex+","+hex+","+hex+")";
setTimeout("fadetext('"+div_id_in+"','"+hex+"')",20); 
}
else
hex=255; //reset hex value
}





