function pictChange(idtocheck, photo_to_paste){
	document.getElementById(idtocheck).src = photo_to_paste;
}
function pictRoll_onclick(idtocheck, photo1, photo2){
	picture = document.getElementById(idtocheck).src;
//	document.write(picture);
	if (picture.indexOf(photo1) != -1)
		document.getElementById(idtocheck).src = photo2;
	else
		document.getElementById(idtocheck).src = photo1;
//		document.write(picture);
}
function visibilityChange(divid){
	if(document.getElementById(divid).style.display == 'none')
		document.getElementById(divid).style.display = 'block';
	else
		document.getElementById(divid).style.display = 'none';
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

/* var oHlpr = document.createElement('IMG');
//var oPic = document.getElementById(id);
//oHlpr.style.visibility = 'hidden';
//oHlpr.style.position = 'absolute';
//oHlpr.top = 0; oHlpr.left = 0;
oHlpr.src = imag.src;
document.body.appendChild(oHlpr);
var imgWidth = oHlpr.offsetWidth;
var imgHeight = oHlpr.offsetHeight
document.body.removeChild(oHlpr); */

	
//var rand = Math.random(1000, 9999);
//var rand2 = Math.random(1000, 9999);
//var imgid = 'img_'+rand+rand2;

function ImgWrapWithShadow(fnsrc, pictwidth, pictheight, fntitle, fnfloat, fnhref, fntarget, colortheme){
	// fnsrc: img/iamge.jpg
	// pictwidth, pictheight - розміри в пікселях в цілих числах.
	// fnfloat: left | center | right
	// fntitle: Назва фотки
	// fntarget: _blank
	// ccolortheme: 1 - це із тіні із сірим бекграундом, 2 - це із білим бекграундом	

// визначаємо розмір зображення, що нам передається
var imag = new Image();
imag.src = fnsrc;
var imgWidth = pictwidth;
var imgHeight = pictheight;

if (imgWidth > 10 && imgHeight > 10){
	var divWidth = imgWidth+22;
	var divHeight = imgHeight+21;
	var a = '<div style="';
	if (fnfloat == 'center')
		a = a+'margin:auto; ';
	else if (fnfloat == 'left' || fnfloat == 'right')
		a = a+'float:'+fnfloat+'; ';
	else return false;
	a = a+'background:url(img/img_shadows_col'+colortheme+'_04.png) repeat-x left top; width:'+divWidth+'px; height:'+divHeight+'px;">'+
	'<div style="background:url(img/img_shadows_col'+colortheme+'_09.png) repeat-y left top; width:'+divWidth+'px; height:'+divHeight+'px;">'+
	'<div style="background:url(img/img_shadows_col'+colortheme+'_12.png) repeat-y right top; width:'+divWidth+'px; height:'+divHeight+'px;">'+
	'<div style="background:url(img/img_shadows_col'+colortheme+'_17.png) repeat-x left bottom; width:'+divWidth+'px; height:'+divHeight+'px;">'+
		'<div style="background:url(img/img_shadows_col'+colortheme+'_03.png) no-repeat left top; width:'+divWidth+'px; height:'+divHeight+'px;">'+
	    '<div style="background:url(img/img_shadows_col'+colortheme+'_06.png) no-repeat right top; width:'+divWidth+'px; height:'+divHeight+'px;">'+
	    '<div style="background:url(img/img_shadows_col'+colortheme+'_15.png) no-repeat left bottom; width:'+divWidth+'px; height:'+divHeight+'px;">'+
	    '<div style="background:url(img/img_shadows_col'+colortheme+'_16.png) no-repeat right bottom; width:'+divWidth+'px; height:'+divHeight+'px;">'+
		'<div style="padding-top:6px; padding-bottom:14px; padding-left:7px; padding-right:14px;">';
	if (fnhref != false)
		a = a+'<a href="'+fnhref+'" ';
	if (fntarget != false)
		a = a+'target="'+fntarget+'" ';
	if (fnhref != false)
		a = a+'style="text-decoration:none;">';
	a = a+'<img ';
	if (fntitle != false)
		a = a+'TITLE="'+fntitle+'" ';
	a = a+'src="'+fnsrc+'" width="'+imgWidth+'" height="'+imgHeight+'" style="border:1px solid #FFFFFF" ';
	//a = a+'src="'+fnsrc+'" width="200px" height="150px" style="border:1px solid #FFFFFF" ';
	if (fnhref != false)
		a = a+'onmouseover="this.style.border=\'1px solid #F07800\';" onmouseout="this.style.border=\'1px solid #FFFFFF\';" /></a>';
	else
		a = a+'/>';
	a = a+'</div>'+
		'</div>'+
		'</div>'+
		'</div>'+
		'</div>'+      
	'</div>'+
	'</div>'+
	'</div>'+
	'</div>';
	document.write(a);
	}
else document.write('Refresh the page to see the picture.');
}
