(function replaceElementsByClass(searchClass) {
	node = document;
	tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	var count = 1;
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
				var re1='.*?';	// Non-greedy match on filler
				var re2='(\\\'.*?\\\')';// Single Quote String 1
				var p = new RegExp(re1+re2,"i");
				var tmp = els[i].getAttributeNode('onclick') != null ? els[i].getAttributeNode('onclick').value : "";
				if(tmp != "")
				{
					var m = p.exec(tmp);
					var popURL = "";
					if (m != null)
					{
					  var strng1=m[1];
					  popURL = strng1.replace(/'/g,'');
					}
					
					var w = "430";
					var h = "440";
					

					var ehouse =/ehouse/g;
					var eres = ehouse.test(popURL);
					var flashFactory = /360Factory/g;
					var fres = flashFactory.test(popURL);
					if(fres){ w="900"; h="500"; }
					
					els[i].removeAttribute("onclick");
					popURL = popURL + "?keepthis=true&tb_iframe=true&height=" + h + "&width=" + w;
					if(eres)
					{
						els[i].href = "javascript:void(window.open('"+popURL+"','Virtual Tours','resizable=no,scrollbars=no,status=no,innerWidth=830,innerHeight=698,centerscreen=true'));";
					}
					else
					{
						els[i].href = "javascript:void($.thickbox_open('Virtual Tours', '"+popURL+"',''));";
					}
					els[i].setAttribute("onclick", "");
					
				}
				j++;
				count++;
		}
	}
})("vtthickbox");
