// JavaScript Document

<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

//changes the Text Header and the Image in order for Picture Gallery can display the image fully
function changeImageLightBox(tagImage,tagLightBoxTitle,strImage,strLightBoxTitle,tagTitleBar,strStyleName)
{
	//gets the properties of the tags
	tagImage = getDocID(tagImage);
	tagLightBoxTitle = getDocID(tagLightBoxTitle);
	tagTitleBar = getDocID(tagTitleBar);

	//checks if there is a LightBox Title to Change
	if(tagLightBoxTitle != null)
		tagLightBoxTitle.innerHTML = strLightBoxTitle;
		
	//checks if there is a tagTarget on the page
	if(tagImage != null)
	{
		//sets the style to be the new iamge
		if(strImage != "")
		{			
			tagImage.src = strImage;
						
			//checks if the width is bigger then height
			/*if(tagImage.width > tagImage.height)
				tagImage.width = 325;
			else
				tagImage.height = 325;*/	
		}//end of if
	}//end of if
	
	//checks if there is a TItle Bar to move in order for the Image to be as big as it wants to be
	if(tagTitleBar != null)
	{
		var intTitleBarStyle = 0;
		
		//checks if the form is IE or the other broswers this is to see if it is need to grow th size to
		//fit the boarder and removes the px at the end of the area
		if (tagTitleBar.currentStyle)
			//IE
			intTitleBarStyle = parseInt(tagTitleBar.currentStyle[strStyleName].substring(0,tagTitleBar.currentStyle[strStyleName].length - 2));
		else
			//other broswers
			intTitleBarStyle = parseInt(document.defaultView.getComputedStyle(tagTitleBar,null).getPropertyValue(strStyleName).substring(0,document.defaultView.getComputedStyle(tagTitleBar,null).getPropertyValue(strStyleName).length - 2));

		//checks if it is need size needs to grow
		if(tagImage.width > intTitleBarStyle)
			tagTitleBar.style.width = (tagImage.width) + "px";
		else
			//removes the style
			tagTitleBar.style.width = '';
	}//end of if
}//end of changeImageLightBox()

//gets the document properties in order to use them as there are many types of browers with different versions
function getDocID(tagLayer)
{
	var tagProp = "";//holds the proerties of tagLayer

	//gets the whichLayer Properties depending of the differnt bowers the user is using
	if (document.getElementById)//this is the way the standards work
		tagProp = document.getElementById(tagLayer);
	else if (document.all)//this is the way old msie versions work
		tagProp = document.all[tagLayer];
	else if (document.layers)//this is the way nn4 works
		tagProp = document.layers[tagLayer];
		
	return tagProp;
}//end of getDocID()

//starts up the page
function startUp()
{
	var oldonload=window.onload;//holds any prevs onload function from the js file
 
	//gets the onload window event checks if there is a function that is already in there
	window.onload=function(){
		if(typeof(oldonload)=='function')
			oldonload();
														
		  //finds which browser the user is using for Firefox it is the defult
		  //for IE 
		  if (navigator.userAgent.indexOf('MSIE') != -1)
		  {
			  if(navigator.appVersion.indexOf('MSIE 7') != -1)
			  {
			  }//end of if
			  else
			  {
				  var tagShowcaseGlassColl = getDocID('divShowcaseGlassColl');//the divShowcaseGlassColl
				  var tagShowcaseClassicColl = getDocID('divShowcaseClassicColl');//the divShowcaseClassicColl
				  
				  //checks if there the page
				  if(tagShowcaseGlassColl != null)
				  {
					  tagShowcaseGlassColl.style.paddingBottom = "13px";
				  }//end of if
				  				
				  //checks if there the page
				  if(tagShowcaseClassicColl != null)
				  {
					  tagShowcaseClassicColl.style.paddingBottom = "13px";
				  }//end of if
			  }//end of else
		  }//end of if
		  //for Safari and Mac
		  else if (navigator.userAgent.indexOf('Safari') !=-1 || navigator.platform.indexOf("Mac") > -1)
		  {
			  //for Firefox for the Mac
			  if (navigator.userAgent.indexOf('Firefox') !=-1)
			  {
			  }//end of if else	
			  
			  var tagShowcaseGlassColl = getDocID('divShowcaseGlassColl');//the divShowcaseGlassColl
			  var tagShowcaseClassicColl = getDocID('divShowcaseClassicColl');//the divShowcaseClassicColl
			  
			  //checks if there the page
			  if(tagShowcaseGlassColl != null)
				  tagShowcaseGlassColl.style.paddingBottom = "13px";
							
			  //checks if there the page
			  if(tagShowcaseClassicColl != null)
				  tagShowcaseClassicColl.style.paddingBottom = "13px";
		  }//end of if else
		  //for Firefox
		  else if (navigator.userAgent.indexOf('Firefox') !=-1)
		  {
		  }//end of if else*/
		  //for Opera
		  else if (navigator.userAgent.indexOf('Opera') !=-1)
		  {
		  }//end of if else
		  
		  //for Chrome
		  if (navigator.userAgent.indexOf('Chrome') !=-1)
		  {
			  var tagShowcaseGlassColl = getDocID('divShowcaseGlassColl');//the divShowcaseGlassColl
			  var tagShowcaseClassicColl = getDocID('divShowcaseClassicColl');//the divShowcaseClassicColl
			  
			  //checks if there the page
			  if(tagShowcaseGlassColl != null)
				  tagShowcaseGlassColl.style.paddingBottom = "13px";
							
			  //checks if there the page
			  if(tagShowcaseClassicColl != null)
				  tagShowcaseClassicColl.style.paddingBottom = "13px";
		  }//end of if else
	}//end of window.onload=function()
}//end of startUp()

//shoes and hides a <div> using display:block/none from the CSS
function toggleLayer(tagLayer,tagGrayOut,tagMedia)
{
	var tagStyle = '';//holds the style of tagLayer

	//gets the tagLayer and tagGrayOut Properties
	tagStyle = getDocID(tagLayer);
	tagGrayOut = getDocID(tagGrayOut);
	tagMedia = getDocID(tagMedia);
		
	if (tagStyle != null)
	{tagStyle.style.display = tagStyle.style.display? "":"block";}
	
	if (tagGrayOut != null)
	{
		tagGrayOut.style.display = tagGrayOut.style.display? "":"block";

		//for IE
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{
			tagGrayOut.attachEvent('onclick',function () {
				toggleLayer(tagStyle.id,tagGrayOut.id)
				
				//specal case pleace remove when REUSING THIS FUNCTION 
				//infoDetailLayer('divShareFriendsBody','divShareMessage','','');
				
				//checks if there is any Media to stop also pleace remove when REUSING THIS FUNCTION 
				if (tagMedia != null)
					tagMedia.Stop();
			});
		}//end of if
		//for the other browsers
		else
		{
			tagGrayOut.addEventListener('click',function () {
				toggleLayer(tagStyle.id,tagGrayOut.id);
				
				//specal case pleace remove when REUSING THIS FUNCTION 
				//infoDetailLayer('divShareFriendsBody','divShareMessage','','');
			},false);
		}//end of else
	}//end of if
}//end of toggleLayer()
