// JavaScript Document

function showsqr( sqr, action ) {
	
	document.getElementById(sqr).style.visibility = action;
	
	//alert(document.getElementById(sqr).style.visibility);
	
}


function showThickBox (title,pageurl) {
	//alert(pageurl);
	//if (!title) title = "test";
	//if (!pageurl) pageurl = "/pressTerms.php?TB_inline=true";
	
	tb_show(title,pageurl);
}


function viewImage ( type ) {
	
	function findValue ( str, attribute ) {
		var arr = splitX[i].split(attribute+'="');
		var strFound = arr[1].substring(0,arr[1].search('"'));
		strFound = strFound.replace(/&amp;/,"&");
		return strFound;
	}
	
	var x = document.getElementById("imageShow");
	var inner = String(x.innerHTML);
	var splitX = inner.split("</a>");
	if (splitX.length <= 1) splitX = inner.split("</A>");
	
	var i=0;
	for (i=0;i<splitX.length;i++)	{
		
		if (!splitX[i].match("none") && splitX[i].length > 1) {
			//alert("length:  "+ splitX[i].length +".......  "+splitX[i]);
			
			// find the href
			hrefFound = findValue(splitX[i],'href');

			// find the title
			titleFound = findValue(splitX[i],'title');
			
			// if the email friend request is called
			if (type == 'emailFriend') {
				hrefFound = 'iframeview.php?img='+hrefFound+'&t=';
				titleFound = 'Email a friend';
			}
			// use tb_show function to load thickbox with title and href
			showThickBox(titleFound,hrefFound);
		}
		
	}

}
