// JavaScript Document

function isIE(){
	return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}

function GetTopLeft(elm) // Copyright 2006-2007 javascript-array.com
{

        var x, y = 0;

    //set x to elm’s offsetLeft
    x = elm.offsetLeft;

    //set y to elm’s offsetTop
y = elm.offsetTop;

    //set elm to its offsetParent
    elm = elm.offsetParent;

    //use while loop to check if elm is null
    // if not then add current elm’s offsetLeft to x
    //offsetTop to y and set elm to its offsetParent

    while(elm != null)
     {

        x = parseInt(x) + parseInt(elm.offsetLeft);
        y = parseInt(y) + parseInt(elm.offsetTop);
        elm = elm.offsetParent;
     }

    //here is interesting thing
    //it return Object with two properties
    //Top and Left

    return {Top:y, Left: x};
}

function getYOffset() {
    var pageY;
    if(typeof(window.pageYOffset)=='number') {
       pageY=window.pageYOffset;
    }
    else {
       pageY=document.documentElement.scrollTop;
    }
    return pageY;
}

function contract(){
	if(!isIE()){
		shot = $('shot');
	}
	new Effect.Fade(shot);
}

function enlarge(img){
	y = getYOffset();
	if(!isIE()){
		shot = $('shot');
	}
	$('shot').update('<p>Click para cerrar</p><img src="'+img+'" alt="" /><p>Click para cerrar</p>');
	shot.style.top = y+'px';
	new Effect.Appear(shot);
}

function button_over(){
	send = $('send');
	send.style.backgroundImage = 'url(images/enviar-hv.png)';
}

function button_out(){
	send = $('send');
	send.style.backgroundImage = 'url(images/enviar.png)';
}