var imageframe = "1";
var zindex = 1000;


      image_url = new Array();
      image_url[0] = "/common/images/picframe-200-230.png";
      image_url[1] = "/common/images/picframeR-200-230.png";
      image_url[2] = "/common/images/picframe-100-115.png";
      image_url[3] = "/common/images/picframeR-100-115.png";
      image_url[4] = "/common/images/picframe-nocrop-PT.png";
      image_url[5] = "/common/images/picframe-nocrop-LS.png";
      image_url[6] = "/common/images/picframe-nocrop.png";


var curHeight;
var curWidth;

function getImgSize(IMG_TITLE, IMG_URL, IMG_Script, IMG_URL_SCALE)
{
var newImg = new Image();

 newImg.onload = function(){var height = newImg.height;
			    var width = newImg.width;
			    p = $(newImg).ready(function(){
				return {width: newImg.width, height: newImg.height};
			    });

			    //getImageFrameWidth(p[0]['width'] , p[0]['height']);
			    }
    newImg.src = IMG_URL;
    
//document.write('<img id="ImgFr'+imagenumber+'" />');	
 
curHeight = newImg.height;
curWidth = newImg.width;


//}

//function getImageFrameWidth(curWidth, curHeight){

//if(curHeight == 230)
//{//frameN();


	if (imageframe == "1")
	{
	imageframe = "2";
	document.write('<a class="sblink" title="'+IMG_TITLE+'" href="'+IMG_URL_SCALE+'"><img src="'+image_url[0]+'" style="z-index:'+zindex+';" class="imgframe1"/></a>');
	zindex = zindex-1;
	}

	else if (imageframe == "2")
	{
	imageframe = "1";
	document.write('<a class="sblink" title="'+IMG_TITLE+'" href="'+IMG_URL_SCALE+'"><img src="'+image_url[1]+'" style="z-index:'+zindex+';" class="imgframe2"/></a>');
	zindex = zindex-1;
	}


/*
}

else if(curHeight > curWidth)
{

document.write('<a class="sblink" title="'+IMG_TITLE+'" href="'+IMG_URL_SCALE+'"><img src="'+image_url[4]+'" height="'+(curHeight+30)+'px" width="'+(curWidth+30)+'px" style="z-index:'+zindex+';" class="nocropPT"/></a>');
zindex = zindex-1;}


else if(curHeight < curWidth)
{document.write('<a class="sblink" title="'+IMG_TITLE+'" href="'+IMG_URL_SCALE+'"><img src="'+image_url[5]+'" height="'+(curHeight+35)+'px" width="'+(curWidth+30)+'px" style="z-index:'+zindex+';" class="nocropLS"/></a>');
zindex = zindex-1;}

else
{document.write('<a class="sblink" title="'+IMG_TITLE+'" href="'+IMG_URL_SCALE+'"><img src="'+image_url[6]+'" height="'+(curHeight+30)+'px" width="'+(curWidth+30)+'px" style="z-index:'+zindex+';" class="nocropLS"/></a>');
zindex = zindex-1;}
*/

}




function frameN()
{


	if (imageframe == "1")
	{
	imageframe = "2";
	document.write('<a class="sblink" title="'+IMG_TITLE+'" href="'+IMG_URL_SCALE+'"><img src="'+image_url[0]+'" style="z-index:'+zindex+';" class="imgframe1"/>');
	zindex = zindex-1;
	}

	else if (imageframe == "2")
	{
	imageframe = "1";
	document.write('<a class="sblink" title="'+IMG_TITLE+'" href="'+IMG_URL_SCALE+'"><img src="'+image_url[1]+'" style="z-index:'+zindex+';" class="imgframe2"/>');
	zindex = zindex-1;
	}

}


function frameL(THB_LINK)
{
var url = THB_LINK;

	if (imageframe == "1")
	{
	imageframe = "2";
	if (url.match("st-thumb-image"))
		{
		document.write('<img src="'+image_url[2]+'" style="z-index:'+zindex+';" class="imgframe1"/>');
		zindex = zindex-1;
	        }
	}

	else if (imageframe == "2")
	{
	imageframe = "3";
		if (url.match("st-thumb-image"))
		{
		document.write('<img src="'+image_url[3]+'" style="z-index:'+zindex+';" class="imgframe2"/>');
		zindex = zindex-1;
	        }	
	}
	
	else if (imageframe == "3")
	{
	imageframe = "1";
		if (url.match("st-thumb-image"))
		{
		document.write('<img src="'+image_url[3]+'" style="z-index:'+zindex+';" class="imgframe2"/>');
		zindex = zindex-1;
	        }	
	}


}
