
function imageFadeIn(img){
  img.opacity = 0;
    setOpacity(img, 30, 5);  
}
function setOpacity (imgName, step, delay){

  var img = document.images[imgName];
  img.opacity += step;
  if (document.all) img.style.filter = 'alpha(opacity = ' + img.opacity + ')'; 
  if (step > 0 && img.opacity < 100 || step < 0 && img.opacity > 0)
    setTimeout('setOpacity("' + img.name + '",' + step + ', ' + delay + ')', delay);
} 
function setPageValues(strName, strToName){

		var strFullImagePath = 'images/btn_' + strToName+".jpg";	
			if (strName=='Decor')
			{
				//alert(document.Decor.src.search(strFullImagePath));
		//	if (document.Decor.src.search(strFullImagePath)<0){
			document.Decor.src = 'images/dummy.jpg';
		    
				if(document.all){
					
					document.Decor.src = strFullImagePath;				
					document.Decor.opacity=0;
					imageFadeIn(strName);	
				}
				else{
					blendimage(strName, strName, strFullImagePath, 100);
					
			 }
			}		
			if (strName=='Menu')
			{
			document.Menu.src = 'images/dummy.jpg';
		
				if(document.all){
					
					document.Menu.src = strFullImagePath;				
					document.Menu.opacity=0;
					imageFadeIn(strName);	
				}
				else{
					blendimage(strName, strName, strFullImagePath, 100);
				}	
			}	
			if (strName=='Recipe')
			{
			document.Recipe.src = 'images/dummy.jpg';
		
				if(document.all){
					
					document.Recipe.src = strFullImagePath;				
					document.Recipe.opacity=0;
					imageFadeIn(strName);	
				}
				else{
					blendimage(strName, strName, strFullImagePath, 100);
				}	
			}	
			if (strName=='About')
			{
			document.About.src = 'images/dummy.jpg';
		
				if(document.all){
					
					document.About.src = strFullImagePath;				
					document.About.opacity=0;
					imageFadeIn(strName);	
				}
				else{
					blendimage(strName, strName, strFullImagePath, 100);
				}	
			}
			if (strName=='Contact')
			{
			document.Contact.src = 'images/dummy.jpg';
		
				if(document.all){
					
					document.Contact.src = strFullImagePath;				
					document.Contact.opacity=0;
					imageFadeIn(strName);	
				}
				else{
					blendimage(strName, strName, strFullImagePath, 100);
				}	
			}
			if (strName=='Home')
			{
			document.Home.src = 'images/dummy.jpg';
		
				if(document.all){
					
					document.Home.src = strFullImagePath;				
					document.Home.opacity=0;
					imageFadeIn(strName);	
				}
				else{
					blendimage(strName, strName, strFullImagePath, 100);
				}	
			}
	}
	function blendimage(strName, imageid, imagefile, millisec) {
	if (strName=='Decor')
			{
	document.Decor.opacity = 0;
	}
    var speed = Math.round(millisec / 1000);
    var timer = 0;
    //set the current image as background
    //document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
    //make image transparent
    changeOpac(0, imageid);
    //make new image
    document.getElementById(imageid).src = imagefile;
    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
	}
	
	function blendimage1( imageid, imagefile, millisec) {
	
    var speed = Math.round(millisec / 1000);
    var timer = 0;
	///alert(document.getElementById(imageid).src+'='+imagefile);
    //set the current image as background
    //document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
    //make image transparent
    changeOpac(0, imageid);
    //make new image
    document.getElementById(imageid).src = imagefile;
    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
	}
	
function changeOpac(opacity, id) {
//alert(opacity+ ',' +id)
var id = id+'1'
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function showFullImage(arg){
	var strImagePath = arg;
	//alert(strImagePath);
	window.open(strImagePath,'','')
} 

function setDecor(strName){
	
		var strFullImagePath = 'images/decor/' + strName;	
		//
	
		if(document.all){	
		//alert(document.fullImage.src.search(strFullImagePath));
		if (document.fullImage.src.search(strFullImagePath)<0){
			document.fullImage.src = 'images/dummy.jpg';
			document.fullImage.src = strFullImagePath;				
			document.fullImage.opacity=0;
			
			imageFadeIn('fullImage');	}
			//
		}
		else{
			
			blendimage1('fullImage', strFullImagePath, 100);
			//alert('test');
		}			
	}
	
	
