// JavaScript Document

function setImage(obj) {
	try{
		var img = new Image();
		img.src = obj.src;
		if(img.height > img.width) {
			obj.height = 150;
			var width = obj.height * (img.width/img.height);
			obj.width = width > 150 ? 150:width;
		}
		else {
			obj.width = 150;
			var height = obj.width * (img.height/img.width);
			obj.height = height > 150 ? 150:height;
		}
	}
	catch(e) { obj.src = "images/image.jpg"; }
}

function setListingsImage(obj) {
	var img = new Image();
	img.src = obj.src;
	if(img.height > img.width) {
		obj.height = 173;
		var width = obj.height * (img.width/img.height);
		obj.width = width > 156 ? 156:width;
	}
	else {
		obj.width = 156;
		var height = obj.width * (img.height/img.width);
		obj.height = height > 173 ? 173:height;
	}
}

function setDetMainImage(obj) {
	try{
		var img = new Image();
		img.src = obj.src;
		if(img.height > img.width) {
			obj.height = 300;
			var width = obj.height * (img.width/img.height);
			obj.width = width > 300 ? 300:width;
		}
		else {
			obj.width = 300;
			var height = obj.width * (img.height/img.width);
			obj.height = height > 300 ? 300:height;
		}
	}
	catch(e) { obj.width = 300; obj.height = 300;}
}

function setDetThumbImage(obj) {
	try{
		var img = new Image();
		img.src = obj.src;
		if(img.height > img.width) {
			obj.height = 100;
			var width = obj.height * (img.width/img.height);
			obj.width = width > 100 ? 100:width;
		}
		else {
			obj.width = 100;
			var height = obj.width * (img.height/img.width);
			obj.height = height > 100 ? 100:height;
		}
	}
	catch(e) {}
}



