﻿
function fnNewWindow( MyURL, MyProperties, MyWidth, MyHeight)
{
var newWindow;
var strProperties = "";

if (MyProperties == "")
	{
	if (MyWidth != "")
		strProperties = 'scrollBars=no,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=' + MyWidth;
	else
		strProperties = 'scrollBars=no,resizable=no,toolbar=no,menubar=no,location=no,directories=no,width=500';

	if (MyHeight != "")
		strProperties += ',height=' + MyHeight;
	else
		strProperties += ',height=500';
}
else
	strProperties = MyProperties
newWindow = window.open(MyURL, "", strProperties);
}


function fnMakeNewWindow( MyURL)
{
var newWindow;
newWindow = window.open(MyURL, "_blank");
}




function switch_photo(oControlName, oRotatingLinkType, oRotatingTextType)
 {
	//If this evaluates to false, don't switch the images.
	//This was done so that multiple photo rotators on the same page can be set to switch at different times
	//rather all changing at the same time.
	if (this.eval(oControlName + '_PhotoPathArray')[this.eval(oControlName + '_ValueArray')[0]] != null)
	{
	
		var imgObj = document.getElementById(oControlName + '_imgPhotoRotation');
		imgObj.style.filter = 'blendTrans(duration=2)';
		imgObj.style.filter = 'blendTrans(duration=crossFadeDuration)';
		
		if (imgObj.filters)
			{
			imgObj.filters.item(0).Apply();
			}
		imgObj.src =  this.eval(oControlName + '_PhotoPathArray')[this.eval(oControlName + '_ValueArray')[0]];
		if (imgObj.filters)
			{
			imgObj.filters.item(0).Play();
			}
			
		// Set Rotating Links
		if ((oRotatingLinkType == '1') || (oRotatingLinkType == '2'))
			{			  
				var linkObj = document.getElementById(oControlName + '_hlPhotos');
				linkObj.href = this.eval(oControlName + '_PhotoLinkArray')[this.eval(oControlName + '_ValueArray')[0]];
				
				//var testlink = this.eval(oControlName + '_PhotoLinkArray')[this.eval(oControlName + '_ValueArray')[0]];

				if (this.eval(oControlName + '_PhotoIsUrlExternal')[this.eval(oControlName + '_ValueArray')[0]] == 'True')
						linkObj.target = 'New';
				else
						linkObj.target = '_top';				
											
				if (linkObj.href == '')
					{
						linkObj.href = 'javascript:void(0);'
						linkObj.disabled=1;
					}
				else
						linkObj.disabled=0;
							
			}
			
		// Set Rotating Text
		if ((oRotatingTextType == '1') || (oRotatingTextType == '2') || (oRotatingTextType == '3'))
			//  PhotoRotator2_TextPrimary
			{			
				var txtObj = document.getElementById(oControlName + '_TextPrimary');
				txtObj.innerHTML = this.eval(oControlName + '_PhotoTextPrimaryArray')[this.eval(oControlName + '_ValueArray')[0]];
			}
			
		if (oRotatingTextType == '3')	
			{
				var imgObj2 = document.getElementById(oControlName + '_imgSecondaryPhotoRotation');
					imgObj2.style.filter = 'blendTrans(duration=2)';
					imgObj2.style.filter = 'blendTrans(duration=crossFadeDuration)';
				if (imgObj2.filters)
					{
					imgObj2.filters.item(0).Apply();
					}
				imgObj2.src =  this.eval(oControlName + '_PhotoSecondaryPathArray')[this.eval(oControlName + '_ValueArray')[0]];
				if (imgObj2.filters)
					{
					imgObj2.filters.item(0).Play();
					}
			}		
	}
	this.eval(oControlName + '_ValueArray')[0]++;
	if (this.eval(oControlName + '_ValueArray')[0] == this.eval(oControlName + '_ValueArray')[1])
		{	
			this.eval(oControlName + '_ValueArray')[0] = 0;
		}
 }