
// detect browser user-agent

var detect = navigator.userAgent.toLowerCase();

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

var ie5=0; moz5=0;
if (checkIt('msie')) ie5 = 1;
else if (!checkIt('compatible')) moz5 = 1;


var thumbs = new Array;
var pics = new Array;
var cnt = 7;
var page_max = 6;
var page_crt = 0;

thumbs[0] = 'images/gallery_default/thumb_image/chooyu/1-Sadhu-Nepal-Gavan.jpg';
thumbs[1] = 'images/gallery_default/thumb_image/chooyu/2-Bagmati-Kathmandu-Nepal-Gavan.jpg';
thumbs[2] = 'images/gallery_default/thumb_image/chooyu/3-Kathmandu-puja-Gavan.jpg';
thumbs[3] = 'images/gallery_default/thumb_image/chooyu/4-Kathmandu-woman-Gavan.jpg';
thumbs[4] = 'images/gallery_default/thumb_image/chooyu/5-Kathmandu-Gavan.jpg';
thumbs[5] = 'images/gallery_default/thumb_image/chooyu/6-Sadhu-Kathmandu-Gavan.jpg';
thumbs[6] = 'images/gallery_default/thumb_image/chooyu/7-Bodnath-Kathmandu-Gavan.jpg';
thumbs[7] = 'images/gallery_default/thumb_image/chooyu/8-Milarepa-cave-Gavan.jpg';
thumbs[8] = 'images/gallery_default/thumb_image/chooyu/9-prayer-flags-Tibet-Gavan.jpg';
thumbs[9] = 'images/gallery_default/thumb_image/chooyu/10-Milarepa-village-Gavan.jpg';
thumbs[10] = 'images/gallery_default/thumb_image/chooyu/11-Nyalam-Tinet-Gavan.jpg';
thumbs[11] = 'images/gallery_default/thumb_image/chooyu/12-Tingri-Gavan.jpg';
thumbs[12] = 'images/gallery_default/thumb_image/chooyu/13-Tingri-Tibet-Gavan.jpg';
thumbs[13] = 'images/gallery_default/thumb_image/chooyu/14-Cho-Oyu-Base-Camp-Gavan.jpg';
thumbs[14] = 'images/gallery_default/thumb_image/chooyu/15-Cho-Oyu-Middle-Camp-Gavan.jpg';
thumbs[15] = 'images/gallery_default/thumb_image/chooyu/16-Cho-Oyu-Gyabrag-Gavan.jpg';
thumbs[16] = 'images/gallery_default/thumb_image/chooyu/17-Oyu-Gavan.jpg';
thumbs[17] = 'images/gallery_default/thumb_image/chooyu/18-Cho-Oyu-Base-Camp-Gavan.jpg';
thumbs[18] = 'images/gallery_default/thumb_image/chooyu/19-Cho-Oyu-Himalaya-Gavan.jpg';
thumbs[19] = 'images/gallery_default/thumb_image/chooyu/20-Cho-Oyu-Camp-Gavan.jpg';
thumbs[20] = 'images/gallery_default/thumb_image/chooyu/21-Cho-Oyu-Himalaya-descent-Gavan.jpg';
thumbs[21] = 'images/gallery_default/thumb_image/chooyu/22-Cho-Oyu-Camp-Gavan.jpg';
thumbs[22] = 'images/gallery_default/thumb_image/chooyu/23-Cho-Oyu-Gavan.jpg';
thumbs[23] = 'images/gallery_default/thumb_image/chooyu/24-Himalaya-Gavan.jpg';
thumbs[24] = 'images/gallery_default/thumb_image/chooyu/25-Camp-Choo-Oyu-Gavan.jpg';
thumbs[25] = 'images/gallery_default/thumb_image/chooyu/26-Cho-Oyu-Camp-Himalaya-Gavan.jpg';
thumbs[26] = 'images/gallery_default/thumb_image/chooyu/27-Gauri-Shankar-Gavan.jpg';
thumbs[27] = 'images/gallery_default/thumb_image/chooyu/28-Cho-Oyu-Shaddow-Gavan.jpg';
thumbs[28] = 'images/gallery_default/thumb_image/chooyu/29-Everest-Gavan.jpg';
thumbs[29] = 'images/gallery_default/thumb_image/chooyu/30-Cho-Oyu-summit-Gavan.jpg';
thumbs[30] = 'images/gallery_default/thumb_image/chooyu/31-Everest-Lhotse-Gavan.jpg';
thumbs[31] = 'images/gallery_default/thumb_image/chooyu/32-Everest-Panorama-Gavan.jpg';

pics[0] = new Array;
pics[0][0] = 'images/gallery_default/big_image/chooyu/1-Sadhu-Nepal-Gavan.jpg';
pics[1] = new Array;
pics[1][0] = 'images/gallery_default/big_image/chooyu/2-Bagmati-Kathmandu-Nepal-Gavan.jpg';
pics[2] = new Array;
pics[2][0] = 'images/gallery_default/big_image/chooyu/3-Kathmandu-puja-Gavan.jpg';
pics[3] = new Array;
pics[3][0] = 'images/gallery_default/big_image/chooyu/4-Kathmandu-woman-Gavan.jpg';
pics[4] = new Array;
pics[4][0] = 'images/gallery_default/big_image/chooyu/5-Kathmandu-Gavan.jpg';
pics[5] = new Array;
pics[5][0] = 'images/gallery_default/big_image/chooyu/6-Sadhu-Kathmandu-Alex-Gavan.jpg';
pics[6] = new Array;
pics[6][0] = 'images/gallery_default/big_image/chooyu/7-Bodnath-Kathmandu-Gavan.jpg';
pics[7] = new Array;
pics[7][0] = 'images/gallery_default/big_image/chooyu/8-Milarepa-cave-Gavan.jpg';
pics[8] = new Array;
pics[8][0] = 'images/gallery_default/big_image/chooyu/9-prayer-flags-Tibet-Gavan.jpg';
pics[9] = new Array;
pics[9][0] = 'images/gallery_default/big_image/chooyu/10-Milarepa-village-Gavan.jpg';
pics[10] = new Array;
pics[10][0] = 'images/gallery_default/big_image/chooyu/11-Nyalam-Tinet-Gavan.jpg';
pics[11] = new Array;
pics[11][0] = 'images/gallery_default/big_image/chooyu/12-Tingri-Gavan.jpg';
pics[12] = new Array;
pics[12][0] = 'images/gallery_default/big_image/chooyu/13-Tingri-Tibet-Gavan.jpg';
pics[13] = new Array;
pics[13][0] = 'images/gallery_default/big_image/chooyu/14-Cho-Oyu-Base-Camp-Gavan.jpg';
pics[14] = new Array;
pics[14][0] = 'images/gallery_default/big_image/chooyu/15-Cho-Oyu-Middle-Camp-Gavan.jpg';
pics[15] = new Array;
pics[15][0] = 'images/gallery_default/big_image/chooyu/16-Cho-Oyu-Gyabrag-Gavan.jpg';
pics[16] = new Array;
pics[16][0] = 'images/gallery_default/big_image/chooyu/17-Cho-Oyu-Gavan.jpg';
pics[17] = new Array;
pics[17][0] = 'images/gallery_default/big_image/chooyu/18-Cho-Oyu-Base-Camp-Gavan.jpg';
pics[18] = new Array;
pics[18][0] = 'images/gallery_default/big_image/chooyu/19-Cho-Oyu-Himalaya-Gavan.jpg';
pics[19] = new Array;
pics[19][0] = 'images/gallery_default/big_image/chooyu/20-Cho-Oyu-Camp-Gavan.jpg';
pics[20] = new Array;
pics[20][0] = 'images/gallery_default/big_image/chooyu/21-Cho-Oyu-Himalaya-descent-Gavan.jpg';
pics[21] = new Array;
pics[21][0] = 'images/gallery_default/big_image/chooyu/22-Cho-Oyu-Camp-Gavan.jpg';
pics[22] = new Array;
pics[22][0] = 'images/gallery_default/big_image/chooyu/23-Cho-Oyu-Gavan.jpg';
pics[23] = new Array;
pics[23][0] = 'images/gallery_default/big_image/chooyu/24-Himalaya-Gavan.jpg';
pics[24] = new Array;
pics[24][0] = 'images/gallery_default/big_image/chooyu/25-Camp-Choo-Oyu-Gavan.jpg';
pics[25] = new Array;
pics[25][0] = 'images/gallery_default/big_image/chooyu/26-Cho-Oyu-Camp-Himalaya-Gavan.jpg';
pics[26] = new Array;
pics[26][0] = 'images/gallery_default/big_image/chooyu/27-Gauri-Shankar-Gavan.jpg';
pics[27] = new Array;
pics[27][0] = 'images/gallery_default/big_image/chooyu/28-Cho-Oyu-Shaddow-Gavan.jpg';
pics[28] = new Array;
pics[28][0] = 'images/gallery_default/big_image/chooyu/29-Everest-Alex-Gavan.jpg';
pics[29] = new Array;
pics[29][0] = 'images/gallery_default/big_image/chooyu/30-Cho-Oyu-summit-Gavan.jpg';
pics[30] = new Array;
pics[30][0] = 'images/gallery_default/big_image/chooyu/31-Everest-Lhotse-Gavan.jpg';
pics[31] = new Array;
pics[31][0] = 'images/gallery_default/big_image/chooyu/32-Everest-Panorama-Gavan.jpg';



function show_thumbs( first )
{
    var prev = document.getElementById( 'prev' );
    var next = document.getElementById( 'next' );

    if ( page_crt == 0 )
    {
        prev.src = 'images/gallery_default/prev_none.gif';
        prev.onclick = null;
        prev.style.cursor = null;
    }
    else
    {
        prev.src = 'images/gallery_default/previous.gif';
        prev.onclick = new Function(' clickPrev(); ');
        prev.style.cursor = 'pointer';
        prev.style.cursor = 'hand';
    }
    if ( page_crt == (page_max - 1) || !page_max )
    {
        next.src = 'images/gallery_default/prev_none.gif';
        next.onclick = null;
        next.style.cursor = null;
    }
    else
    {
        next.src = 'images/gallery_default/next.gif';
        next.onclick = new Function(' clickNext(); ');
        next.style.cursor = 'pointer';
        next.style.cursor = 'hand';
    }

    for( var i=0; i<cnt; i++ )
    {
        var crt = page_crt * cnt + i;
        var img = document.getElementById( i );
        if ( thumbs[crt] )
        {
            img.src = thumbs[crt];
            img.onclick = new Function(' show_poza( '+i+', 0 ); ');
            img.style.cursor = 'pointer';
            img.style.cursor = 'hand';
        }
        else
        {
            img.src = 'images/gallery_default/thumb_none.gif';
            img.onclick = null;
            img.style.cursor = null;
        }
    }

    var pos_crt = page_crt * cnt + first;

    show_poza( pos_crt, 0 );

}

function show_poza( pos, pic_poz )
{
	var pos_crt = page_crt * cnt + pos;
    if ( pics[pos_crt] )
    {
        var len = pics[pos_crt].length;


        if( len > 0 )
        {
            var img_poza = document.getElementById('poza');
            img_poza.src = pics[pos_crt][pic_poz];

            if ( len > 1 )
            {
                for( var zz=0; zz<len; zz++ )
                {
                    var nim = document.createElement('img');
                    nim.id = 'bullet_' + zz;
                    nim.src = ( zz == pic_poz ) ? "images/gallery_default/bullet_on.gif" : "images/gallery_default/bullet_off.gif";
                    nim.style.cursor = 'pointer';
                    nim.style.cursor = 'hand';
                    eval ('nim.onclick = function(e) { show_poza( '+pos+', '+zz+' ); }; ');

/*                    zona_vers.appendChild(nim);*/
                }
            }
        }
    }
}

function clickPrev()
{
    page_crt--;
    show_thumbs();
}

function clickNext()
{
    page_crt++;
    show_thumbs();
}
