var url = "http://www.modelsinternational.co.za"
var shorturl = "http://modelsinternational.co.za"
//var url = "http://localhost:55270/ModelsInc/"

function RemoveBigAddSmallProductResize(val) {
    val = val.replace(url, '')
    val = val.replace(shorturl, '')
    val = val.replace("thumbnail.aspx?width=420&filename=","")
    val = "thumbnail.aspx?width=60&filename="+ val
    return val
}

function RemoveSmallAddBigProductResize(val) {
    val = val.replace(url, '')
    val = val.replace(shorturl, '')
    val = val.replace("thumbnail.aspx?width=60&filename=","")
    val = "thumbnail.aspx?width=420&filename="+ val
    return val
}

function TargetImage(imageid) {
	var oldmainimagesrc = String();
	oldmainimagesrc = document.getElementById("ModelImg").src;
	t = RemoveSmallAddBigProductResize(document.getElementById("GalleryImage" + imageid).src);
	document.getElementById("ModelImg").src = t;
	currentsrc2 = document.getElementById("GalleryImage" + imageid).src;
	oldmainimagesrc = RemoveBigAddSmallProductResize(oldmainimagesrc)
	document.getElementById("GalleryImage" + imageid).src = oldmainimagesrc;	
	
	fullurl=location.href.replace(/\?.*/,'') 
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	finalurl = fullurl.replace(sPage,'')
	
	currentsrc2 = currentsrc2.replace("thumbnail.aspx?width=60&filename=","")
	
	currentsrc2 = currentsrc2.replace(finalurl,'')
	document.getElementById("ImagePopUpLink").href = "javascript:pop('flashpreview.aspx?imageurl="+ currentsrc2 +"',800,600);"
}
