var p = null;

function swapThis(url, obj, width, height, imgurl, par, isFlash)
{
	if(obj.parentNode)
	{
		p = obj.parentNode;
	}
	else
	{
		p = document.getElementById(obj+"_img").parentNode;
		obj = document.getElementById(obj+"_img");
	}


	obj.parentNode.style.height = height + "px";
	obj.parentNode.style.width = width + "px";
	

	if(isFlash)
	{
		var s2 = new SWFObject(url,obj.parentNode.id,"100%","100%","8");
		s2.addParam("scale", "scale");
		s2.addParam("allowFullScreen", "true");
		
		s2.write(obj.parentNode.id);
	}
	else if(isFlash == false)
	{
		p.innerHTML = "<iframe frameborder=\"0\" border=\"0\" src=\""+url+"\" width=\""+width+"\" height=\""+height+"\"/>";
	}
	
	p.innerHTML += "<div onclick=\"swapBack('"+imgurl+"','"+p.id+"','"+arguments[0]+"','"+arguments[1]+"','"+arguments[2]+"','"+arguments[3]+"',"+isFlash+")\" class=\"close\" id=\"close_"+p.id+"\">Close X</div>";

	document.getElementById("close_"+p.id).style.left = width-50+"px";
	document.getElementById("close_"+p.id).style.top = -height-4+"px";
	
	document.getElementById(p.id + "_directions").style.display = "block";
	
	document.getElementById(p.id + "_view").style.display = "none";
}

function swapBack(imageUrl, holder, swfUrl, obj, w, h, isFlash)
{
	document.getElementById(holder).innerHTML = "<img id=\""+holder+"_img\" onclick=\"swapThis('"+swfUrl+"','"+holder+"','"+w+"','"+h+"','"+imageUrl+"','"+obj+"',"+isFlash+")\" class=\"thumb-img\" src=\""+imageUrl+"\" height=\"150\" width=\"250\" />";
	
	document.getElementById(document.getElementById(holder).id + "_directions").style.display = "none";
	document.getElementById(document.getElementById(holder).id + "_view").style.display = 'block';
	
	document.getElementById(holder).style.height = "150px";
	document.getElementById(holder).style.width = "250px";
}

function toggleMe(obj, url, imgElement, width, height, imgUrl, parentElement, isFlash)
{
		swapThis(url, imgElement, width, height, imgUrl, parentElement, isFlash);
		obj.style.display = 'none';
}

function hideMe()
{
	showAll('ai','mmfx','abs','cardcat','itv','balloon','scroller','map','micro','lawson','message','resume')
	for(i = 0; i < arguments.length ; i++)
	{
		var o = document.getElementById(arguments[i]+"_holder");
		var height = o.style.height;
		
		document.getElementById(arguments[i]+"_holder").style.display = 'none';
	}
}

function showAll()
{
	for(i = 0; i < arguments.length ; i++)
	{
		document.getElementById(arguments[i]+"_holder").style.display = 'block';
	}
}