// JavaScript Document

function embedPano(panoName, iPhoneEnabled)
{
	embedCustomPano(panoName, iPhoneEnabled, 640, 360);
}

function embedCustomPano(panoName, iPhoneEnabled, wid, hei)
{
	var isiPad = navigator.userAgent.match(/iPad/i) != null;
	var isiPhone = navigator.userAgent.match(/iPhone/i) != null;
	
	if (isiPhone || isiPad)
	{
		if (iPhoneEnabled)
		{
			document.write('<a href="http://leecasalena.com/view/?t=s&amp;s='+panoName+'&amp;w='+wid+'&amp;h='+hei+'" target="_blank"><img src="http://leecasalena.com/view/img/view_pano.jpg" width="'+wid+'" height="'+hei+'" alt="View Panorama" border="0"/></a>');
		}
		else
		{
			document.write('<div id="panorama_div_'+rand+'">iPhone or iPad Version not available. </div>');
		}
	}
	else
	{
		var rand = Math.floor(Math.random()*1000000000)
		if (iPhoneEnabled)
		{
			document.write('<div id="panorama_div_'+rand+'">Flash Required (iPhone / iPad Version not available for this panorama)</div>');
		}
		else
		{
			document.write('<div id="panorama_div_'+rand+'">Flash, iPhone or iPad Required. </div>');			
		}
		var swf = createswf("http://leecasalena.com/view/krp/krpano.swf", "panorama_id", ""+wid, ""+hei);
		swf.addVariable("xml", "http://leecasalena.com/view/xml/?s="+panoName+"%26t=SPHERE");
		swf.embed('panorama_div_'+rand);
	}
}
