// Modyfied by Morowiec
//
// Copyright (c) 2006. Adobe Systems Incorporated.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   * Redistributions of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//   * Redistributions in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//   * Neither the name of Adobe Systems Incorporated nor the names of its
//     contributors may be used to endorse or promote products derived from this
//     software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.


ie5  = (document.all && document.getElementById);
ns6 = (!document.all && document.getElementById);
opera = (document.all && document.getElementById);

opac3 = 0;
 
function menuImgShow(targetElement, menuElement) {
    if(opac3 < 100){
        opac3+=5;
        if(ie5) document.getElementById(targetElement).filters.alpha.opacity = opac3;
        if(ns6) document.getElementById(targetElement).style.MozOpacity = opac3/100;
        if(opera) document.getElementById(targetElement).style.opacity = (opacity/100) ;
        setTimeout('opacIn('+targetElement+', '+menuElement+')', 50);
    }else{
        
//        opacOut();
    }
}
 
function menuImgHide(targetElement, menuElement) {
    if(opac3 > 0){
        opac3-=5;
        if(ie5) document.getElementById(targetElement).filters.alpha.opacity = opac3;
        if(ns6) document.getElementById(targetElement).style.MozOpacity = opac3/100;
        if(opera) document.getElementById(targetElement).style.opacity = (opacity/100) ;
     
        setTimeout('opacOut('+targetElement+', '+menuElement+')', 50);
    }else{
//        opacIn();
    }
}

/*
function menuImgShow(targetElement, menuElement) {
	var ie4, ns4, ns6; 
	ie5 = (document.all) && (parseInt(navigator.appVersion) >= 4);
	ns6 = (navigator.product=="Gecko");
	
	for (var i = 1; i<=menuElement; i++) {
		if(ie5) document.getElementById("menu"+i).filters.alpha.opacity = 0;
		if(ns6) document.getElementById("menu"+i).style.MozOpacity = 0/100;
	}
	Spry.Effect.DoFade(targetElement, {duration: 300, from: 0, to: 100, toggle: true});
}
function menuImgHide(targetElement, menuElement) {
	var ie4, ns4, ns6; 
	ie5 = (document.all) && (parseInt(navigator.appVersion) >= 4);
	ns6 = (navigator.product=="Gecko");
	
	Spry.Effect.DoFade(targetElement, {duration: 300, from: 100, to: 0, toggle: true});
	for (var i = 1; i<=menuElement; i++) {
		if(ie5) document.getElementById("menu"+i).filters.alpha.opacity = 0;
		if(ns6) document.getElementById("menu"+i).style.MozOpacity = 0/100;
	}
}

*/

function growPicture(id, toWidth, toHeight) {
	document.getElementById(id).style.Zindex = 150;
	
	toX = Math.floor((document.getElementById(id).width-toWidth)/2);
	toY = Math.floor((document.getElementById(id).height-toHeight)/2);

	var ele = Spry.Effect.getElement(id); 
	
	Spry.Effect.makePositioned(document.getElementById(id));
	var move_effect = new Spry.Effect.Move(id, { x: 0, y: 0, units: "px" }, { x: toX, y: toY, units: "px" }, {duration: 400, toggle: true});

	Spry.Effect.makeClipping(document.getElementById(id));
	var size_effect = new Spry.Effect.Size(id, Spry.Effect.getDimensions(ele), { width: toWidth, height: toHeight, units: "px" }, {duration: 400, toggle: true, scaleContent: true});

	move_effect.start();
	size_effect.start();

}

function shrinkPicture(id, toWidth, toHeight) {
	document.getElementById(id).style.Zindex = 1;
	fromX = Math.floor((toWidth - document.getElementById(id).width)/2);
	fromY = Math.floor((toHeight - document.getElementById(id).height)/2);

	var ele = Spry.Effect.getElement(id); 
	
	Spry.Effect.makePositioned(document.getElementById(id));
	var move_effect = new Spry.Effect.Move(id, { x: fromX, y: fromY, units: "px" }, { x: 0, y: 0, units: "px" }, {duration: 400, toggle: true});

	Spry.Effect.makeClipping(document.getElementById(id));
	var size_effect = new Spry.Effect.Size(id, Spry.Effect.getDimensions(ele), { width: toWidth, height: toHeight, units: "px" }, {duration: 400, toggle: true, scaleContent: true});

	move_effect.start();
	size_effect.start();
}

