function CheckLength(textBox, maxLength)
{
	if(textBox.value.length > maxLength)
		textBox.value = textBox.value.substring(0, maxLength);

}

function FFpreviewImage()
{
	if(navigator.appName.toLowerCase() == "netscape")
	{
		document.getElementById("previewImage").src = "images/previewNotAvailable.jpg";
		document.getElementById("previewImage").title = "Your browser does not support this feature"
	}
}
function previewImageFunc()
{	
	var filename; 
	filename = document.getElementById("uploadButton").value;
	var fileExtension = filename.substring(filename.lastIndexOf(".")+1); 
	if (fileExtension == "jpg" || fileExtension == "jpeg" || fileExtension == "gif") 
	{     
		document.getElementById("previewImage").src = filename;
		document.getElementById("avatarLinkHolder").value = "";
	}
	else   
	{ 
		alert ("Only jpg, jpeg and gif files are allowed.");
	}

}


function setPreviewFromList(theImageObject)
{
	document.getElementById("previewImage").src = theImageObject.src;
	document.getElementById("avatarLinkHolder").value = theImageObject.src;
	document.getElementById("uploadButton").value = "";
}

// The following script will toggle between images (ie mouseovers)/////////////////////////
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];}

}
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 prevBanner(selectedBannerFileName, textInput1, textInput2, textInput3, textInput4, textXpos, textYpos, selectedFont, bannerTextSize, selectedColor, selectedIcon, nameInput, titleInput)
{
	document.getElementById("headerFlashContent").previewBanner(selectedBannerFileName, textInput1, textInput2, textInput3, textInput4, textXpos, textYpos, selectedFont, bannerTextSize, selectedColor, selectedIcon, nameInput, titleInput);
}


window.onload= function ()
{ 
        
        document.getElementById("headerFlashContent").previewBanner = function(selectedBannerFileName, textInput1, textInput2, textInput3, textInput4, textXpos, textYpos, selectedFont, bannerTextSize, selectedColor, selectedIcon, nameInput, titleInput) 
        {
			
			var flsshAXString = "<invoke name=\"previewBanner\" returntype=\"javascript\"><arguments>";
			flsshAXString += "<string>"+selectedBannerFileName+"</string>";
			flsshAXString += "<string>"+textInput1+"</string>";
			flsshAXString += "<string>"+textInput2+"</string>";
			flsshAXString += "<string>"+textInput3+"</string>";
			flsshAXString += "<string>"+textInput4+"</string>";
			flsshAXString += "<string>"+textXpos+"</string>";
			flsshAXString += "<string>"+textYpos+"</string>";
			flsshAXString += "<string>"+selectedFont+"</string>";
			flsshAXString += "<string>"+bannerTextSize+"</string>";
			flsshAXString += "<string>"+selectedColor+"</string>";
			flsshAXString += "<string>"+selectedIcon+"</string>";
			flsshAXString += "<string>"+nameInput+"</string>";
			flsshAXString += "<string>"+titleInput+"</string>";
			flsshAXString += "</arguments></invoke>";
			document.Form1.headerFlashContent.CallFunction(flsshAXString) 
        } 
 } 


///////////////////////////////////////////////////////////////////////////////////////////

function openGallery()
{	
	window.open ("0003DGallery.aspx", "0003DGallery", "location=0,status=0,scrollbars=0,border=0,margin=0,width=800,height=600");
}

function openGalleryForUser(inputName)
{
	window.open ("0003DGallery.aspx?inputName=" + inputName, "0003DGallery", "location=0,status=0,scrollbars=0,border=0,margin=0,width=800,height=600");
}
///////////////////////////////////////////////////////////////////////////////////////////
function bookMark()
{
	var url = "http://www.BannerMoments.com";
	var who = "BannerMoments Create Your Own Banner"

	if (window.sidebar)  // Mozilla Firefox Bookmark
			window.sidebar.addPanel(who, url,"");	
	else if( window.external )  // IE Favorite
			window.external.AddFavorite( url, who); 	
	else if(window.opera && window.print)  // Opera Hotlist
			return true; 

}

///////////////////////////////////////////////////////////////////////////////////////////
function printPage()
{
	window.print();
}

function SearchIt()
{
	var urlString = "000SiteSearch.aspx?searchString=" + document.getElementById("txtSearchBox").value;
	window.open(urlString, "_self");

}



function launchwin(winurl,winname,winfeatures)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl,winname,winfeatures);
	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}