var xmlhttp

function showHint(str)
{
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null)
    {
        alert ("Your browser does not support XMLHTTP!");
        return;
    }
    var url="gethint.php";
    url=url+"?q="+str;
    url=url+"&sid="+Math.random();
    xmlhttp.onreadystatechange=stateChangedHint;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

function stateChangedHint()
{
    if (xmlhttp.readyState==4)
    {
        document.getElementById("albuns").innerHTML=xmlhttp.responseText;
    }
}

function showHintDDD(str)
{
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null)
    {
        alert ("Your browser does not support XMLHTTP!");
        return;
    }
    var url="gethintDDD.php";
    url=url+"?q="+str;
    url=url+"&sid="+Math.random();
    xmlhttp.onreadystatechange=stateChangedHintDDD;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

function stateChangedHintDDD()
{
    if (xmlhttp.readyState==4)
    {
        document.getElementById("albunsDDD").innerHTML=xmlhttp.responseText;
    }
}

function showAlbum(Opt, Dir, Img)
{
    xmlhttp=GetXmlHttpObject();
    if (xmlhttp==null)
    {
        alert ("Your browser does not support XMLHTTP!");
        return;
    }
    var url="getAlbum.php";
    url=url+"?O="+Opt+"&D="+Dir+"&I="+Img;
    url=url+"&sid="+Math.random();
    xmlhttp.onreadystatechange=stateChangedAlbum;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
}

function stateChangedAlbum()
{
    if (xmlhttp.readyState==4)
    {
        document.getElementById("main").innerHTML=xmlhttp.responseText;
    }
}

function GetXmlHttpObject()
{
    if (window.XMLHttpRequest)
    {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        return new XMLHttpRequest();
    }
    if (window.ActiveXObject)
    {
        // code for IE6, IE5
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
    return null;
}

$(document).ready(function() 
{
    var move = 0;
    var zoom = 1.3;

    $('.item').hover(function() 
    {
        width = $('.item').width() * zoom;
        height = $('.item').height() * zoom;

        $(this).find('img').stop(false,true).animate({'width':width, 'height':height, 'top':move, 'left':move}, {duration:300});
        $(this).find('div.caption').stop(false,true).fadeIn(300);
    },
    function() 
    {
        $(this).find('img').stop(false,true).animate({'width':$('.item').width(), 'height':$('.item').height(), 'top':'0', 'left':'0'}, {duration:300});    
        $(this).find('div.caption').stop(false,true).fadeOut(400);
    });
});

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

function mycarousel_getItemHTML(item)
{
    return '<a href="maispic.php?&D=' + item.Dir + '&I=' + item.Img + '">' + item.Name + 
           '<img src="' + item.url + '" /></a>';
};

jQuery(document).ready(function() 
{
    jQuery('#mycarousel').jcarousel(
    {
        wrap: 'circular',
        start: mycarousel_initItem,
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});

// Browser Window Size and Position ------------------------------------------------------------------------
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
function pageWidth() 
{
    return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function pageHeight() 
{
    return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

function posLeft() 
{
    return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}

function posTop() 
{
    return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

function posRight() 
{
    return posLeft()+pageWidth();
}

function posBottom() 
{
    return posTop()+pageHeight();
}

function displayAll()
{
var w = screen.width;
var h = screen.height;

alert('You are using ' + w + 'x' + h + ' resolution...!');
        if (pageWidth() == null)
            alert('O panaca é nullo!....<BR>');
        else
	alert('<p>kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk page=(' + pageWidth()+ ',' + pageHeight() + ') pos=('+ posLeft()+ ',' + posTop()+ ',' + posRight()+ ',' + posBottom() + ')</p>');


}

function alertSize() 
{
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}
// ---------------------------------------------------------------------------------------------------------


