function change(imgModule,imgObject) {
document.images[imgModule].src = eval(imgObject + ".src");
}

function changesrc(newsrc,imgObject) {
document.images[imgObject].src = newsrc;
}

function changesrcthis(newsrc,imgObject) {
imgObject.src = newsrc;
}

function changeImage(id, imageName, imageTitle, strLink){
	if (document.getElementById("img" + id)) {
		document.getElementById("img" + id).src = imageName;
		document.getElementById("img" + id).title = imageTitle;
		document.getElementById("img" + id).alt = imageTitle;
		$("#lnk" + id).attr('href', strLink);
	}
}

function mychangeimage(id, imageName, imageTitle, strLink, altText){
	$("#lnk" + id).attr('href', strLink);
	$("#img" + id).attr('alt', imageTitle);
	document.getElementById("img" + id).src = imageName;
}

function mychangeimage2(id, imageName, imageTitle, strLink, altText) {
	$("#lnk" + id).attr('href', strLink);
	$("#img" + id).attr('alt', imageTitle);
	$('#img'+id).one('load', function() {
		if($('#img' + id).height()==1) {
			mychangeimage2(id, imageName, imageTitle, strLink, altText);
			return;
		}
		if($('#img' + id).height()>384) {
			$('#pnlfor' + id + '>a').remove();
			$('#pnlfor' + id).append('<a href="#" style="display:block; position:absolute; left:0; top:0; width:100%; height:100%; font-size:102px; color:#fff; text-decoration:none; z-index:500;  background-image:url(/public/t/tpl/img/1px.gif);" onclick="myresizer(\''+id+'\'); return false;"><img id="imgzoomer" src="/public/i/+.png" alt="" style="margin:5px; border:none;"></a>');
		} else if($('#img' + id).width()>555) {
			$('#pnlfor' + id + '>a').remove();
			$('#pnlfor' + id).append('<a href="#" style="display:block; position:absolute; left:0; top:0; width:100%; height:100%; font-size:102px; color:#fff; text-decoration:none; z-index:500;  background-image:url(/public/t/tpl/img/1px.gif);" onclick="myresizer(\''+id+'\'); return false;"><img id="imgzoomer" src="/public/i/+.png" alt="" style="margin:5px; border:none;"></a>');
		} else {
			$('#pnlfor' + id + '>a').remove();
		}

		if(altText!='') {
			$('#pnlfor' + id + '>div').remove();
			$('#pnlfor' + id).append(
				'<div id="descpan" style="border: 1px solid rgb(34, 34, 34); margin: 5px; padding: 5px; display: block; position: absolute; left: 0pt; bottom: 0pt; background-color: rgb(238, 238, 238); color: rgb(34, 34, 34); text-decoration: none; z-index: 500; background-image: url(/public/t/tpl/img/1px.gif);">'+
				altText +
				'</div>'
			);
		} else {
			$('#pnlfor' + id + '>div').remove();
			$('#pnlfor' + id).append('<div id="descpan"></div>');
		}

		$('#pnlfor' + id).css('height', '383px');
		$('#pnlfor' + id).css('width', '555px');
		$('#pnlfor' + id).css('top', '0');
		$('#pnlfor' + id).css('left', '0');

		$('#pnlfor' + id).css('position', 'relative');
		$('#pnlfor' + id).css('margin-left', '0');
		$('#pnlfor' + id).css('margin-top', '0');
		$('#pnlfor' + id).css('border', 'none');
	});
	$("#img" + id).attr('src', imageName);

}
function myresizer(id) {
	var h_img = $('#img' + id).height();
	var h_pnl = $('#pnlfor' + id).height();

	var w_img = $('#img' + id).width();
	var w_pnl = $('#pnlfor' + id).width();

	if(h_pnl<=383 && h_img>386) {
		$('#imgzoomer').attr('src', '/public/i/-.png');
		$('#pnlfor' + id).css('position', 'absolute');
		$('#pnlfor' + id).css('margin-left', '-1px');
		$('#pnlfor' + id).css('margin-top', '-1px');
		$('#pnlfor' + id).css('border', '3px solid #000');

		$('#pnlfor' + id).css('z-index', '1000');
		
		$('#pnlfor' + id).animate({
			height: h_img+'px',
			top: -Math.round((h_img-384)/2)+'px'
		}, 500);
	} else if(w_pnl<=555 && w_img>555) {
		$('#imgzoomer').attr('src', '/public/i/-.png');
		$('#pnlfor' + id).css('position', 'absolute');
		$('#pnlfor' + id).css('margin-left', '-1px');
		$('#pnlfor' + id).css('margin-top', '-1px');
		$('#pnlfor' + id).css('border', '3px solid #000');

		$('#pnlfor' + id).css('z-index', '1000');

		var w_bdy = $('body').width();
		var l_pos = $('#pnlfor' + id).parent().parent().parent().position().left;
		var pos = Math.round((w_bdy - w_img)/2 - l_pos);
		pos = (pos<0) ? pos : 0;
		pos = (pos<-l_pos) ? -l_pos : pos;

		$('#pnlfor' + id).animate({
			width: w_img+'px',
			left: pos+'px'
		}, 500);
	} else {
		myminsizer(id);
	}
}

function myminsizer(id) {
	$('#pnlfor' + id).animate({
		height: '383px',
		top: 0+'px',
		width: '555px',
		left: 0+'px'
	}, 500, 'swing', function() {
		$('#imgzoomer').attr('src', '/public/i/+.png');

		$('#pnlfor' + id).css('position', 'relative');
		$('#pnlfor' + id).css('margin-left', '0');
		$('#pnlfor' + id).css('margin-top', '0');
		$('#pnlfor' + id).css('border', 'none');
	});
}

function mychange(imgModule, imgObject) {
	imgObject.src = imgModule;
	var ClientPC = navigator.userAgent.toLowerCase();
	var ClientVer = parseInt(navigator.appVersion);
	var IsIE = ((ClientPC.indexOf("msie") != -1) && (ClientPC.indexOf("opera") == -1));
	var IsWin = ((ClientPC.indexOf("win")!=-1) || (ClientPC.indexOf("16bit") != -1));

	if ((ClientVer >= 4) && IsIE && IsWin) {
		fixPNG(imgObject,0);
	}
}
