
var gallerytomb = new Array();
var tombindex = -1;
/*
$(document).ready(function() {
	var elotoltes = "";

	var i;
	for (i=0;i<gallerytomb.length;i++) {
		elotoltes = elotoltes + '<img src="' + gallerytomb[i] + '?' + i + '" alt="" />';
	}

	document.getElementById('gallery_content').innerHTML = '<div style="display: none">' + elotoltes + '</div><img id="gallery_content_img" src="" alt="" />';
	gallery_next();
});
*/

/***/

document.onmousemove = mouseXandY;
       var mosX = 0 ;
       var mosY = 0 ;
       function mouseXandY(e) { // by Kravvitz of DynamicSiteSolutions.com
         e=e||window.event;
          if(e.pageX || e.pageY) {
            mosX=e.pageX;
            mosY=e.pageY;
			          } else if(typeof(e.clientX)=='number') {
            var dE=document.documentElement;
            mosX=e.clientX+document.body.scrollLeft+(dE?dE.scrollLeft:0);
            mosY=e.clientY+document.body.scrollTop+(dE?dE.scrollTop:0);
			          }
          return true;
        }
		
	

/***/

var fullimagediv;

function showGalleryFullPic(pic,type,id,large_height,large_width){
	
	small = document.getElementById("image_"+type+"_"+id);
	
	for(k=0;k<=50;k++){
		if(document.getElementById("gallery_full_pic_"+k) != undefined){
			document.getElementById("gallery_full_pic_"+k).innerHTML = "";
			document.getElementById("gallery_full_pic_"+k).style.display = "none";
		}
	}
	
	small_height = small.offsetHeight;
	small_width = small.offsetWidth;
	
	scroll_top = document.body.scrollTop;
	scroll_left = document.body.scrollLeft;
	
	small_top = small.offsetTop;
	small_left = small.offsetLeft;
	
	//large_top = ( - ( large_height - small_height ) / 2 )  - scroll_top + "px";
	//large_left = ( - ( large_width - small_width ) / 2 ) - scroll_left + "px";
	
	//if(ie){
		product = document.getElementById("product_"+id);
		large_top = product.offsetTop+2+"px";
		large_left = product.offsetleft+2+"px";
	//}
	/*else{
		large_top = "0px";
		large_left = "0px";
	}*/
	
    fullimagediv = document.getElementById("gallery_full_pic_"+id);
	fullimagediv.innerHTML = "<img id=\"gallery_full_pic_img_"+id+"\" src=\""+pic+"\" style=\"z-index:100;cursor:pointer;height:auto;width:auto;position:absolute;top:"+large_top+"\" onClick=\"hideGalleryFullPic()\" />"; //;left:"+large_left+"
	
	fullimagediv.style.display = "block";
	
}

function hideGalleryFullPic(pic){
	
	/*for(k=0;k<=50;k++){
		if(document.getElementById("gallery_full_pic_"+k) != undefined){
			document.getElementById("gallery_full_pic_"+k).innerHTML = "";
			document.getElementById("gallery_full_pic_"+k).style.display = "none";
		}
	}*/
	
	fullimagediv.innerHTML = "";
	fullimagediv.style.display = "none";
}

function gallery_next(){

	tombindex++;
	var volt = gallery_check_show_hide_button();
	if (!volt){
		//document.getElementById('gallery_content').innerHTML = '<img src="' + gallerytomb[tombindex] + '?' + tombindex + '" alt="" />';
		document.getElementById('gallery_content_img').src = gallerytomb[tombindex] + '?' + tombindex;
		//alert('step');
	}
	else alert('next volt');

}

function gallery_prev(){

	tombindex--;
	var volt = gallery_check_show_hide_button();
	if (!volt){
		//document.getElementById('gallery_content').innerHTML = '<img src="' + gallerytomb[tombindex] + '?' + tombindex + '" alt="" />';
		document.getElementById('gallery_content_img').src = gallerytomb[tombindex] + '?' + tombindex;
	}
	else alert('prev volt');

}

function gallery_check_show_hide_button(){

	var is_correction = false;

	if(tombindex >= (gallerytomb.length - 1)){

		document.getElementById('gallery_right').style.visibility = 'hidden';
		//tombindex--;
		//is_correction = true;

	} else {

		//alert(document.getElementById('gallery_right'));
		document.getElementById('gallery_right').style.visibility = 'visible';

	}

	if(tombindex <= 0){

		document.getElementById('gallery_left').style.visibility = 'hidden';
		//tombindex++;
		//is_correction = true;

	} else {

		document.getElementById('gallery_left').style.visibility = 'visible';

	}

	return is_correction;

}

