// 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 = (173 * img.width)/img.height;
		width = width > 156 ? 156:width;			
		obj.width= (width > 0 ? width : 156) ;		
	}
	else 
	{	    
		obj.width = 156;
		var height =(156 * img.height)/img.width;				
		height = height > 173 ? 173:height;		
		
		obj.height = (height > 0 ? (height-6) : 173);				
		
	}
}

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
	{
//	    if(preobj!=obj.src)
//	    {
		    var img = new Image();
		    img.src = obj.src;
		    if(img.height > img.width) 
		    {		    
			    obj.height = 100;
			    var width = (100 * img.width)/img.height;
			    width = width > 100 ? 100:width;			    
			    obj.width=	(width > 0 ? width : 100);		    	    
		    }
		    else 
		    {		    
			    obj.width = 100;
			    var height = (100 * img.height)/img.width;
			    height = height > 100 ? 100:height;	  
			    obj.height= (height > 0 ? height :100);
		    }
//		    preobj=img.src;			    
//		}
	}
	catch(e) {}		
}




