//PARENT WINDOW
self.name="monrepossports";
self.focus();

// ------------------------POPUP SETUP - START SCRIPT-------------------------- //

// Script Source: CodeLifter.com
// Copyright 2003

// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 50;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = true;

//BROWSER RECOGNITION STUFF
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
	//check image url
	if(imageURL.indexOf("http")==-1){
		imageURL="<%=strRootPath%>"+imageURL;
	}
	
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}

	with (imgWin.document){
		writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('var maxWidth=screen.width-110;');
		writeln('var maxHeight=screen.height-110;');
		writeln('function reSizeToImage(){');
		writeln('if (isIE){');
		writeln('window.resizeTo(300,300);');
		writeln('width=document.images[0].width;');
		writeln('height=document.images[0].height;');
		writeln('if(width>maxWidth || height>maxHeight){');
		writeln('if(maxWidth*height/width<=maxHeight){');
		writeln('height=Math.round(maxWidth*height/width);');
		writeln('width=maxWidth;');
		writeln('} else {');
		writeln('width=Math.round(maxHeight*width/height);');
		writeln('height=maxHeight;}}');
		writeln('document.images[0].width=width;');
		writeln('document.images[0].height=height;');
		writeln('window.resizeTo(width,height+20);');
		writeln('var windowX=(screen.width/2)-(document.body.clientWidth/2);');
		writeln('var windowY=(screen.height/2)-(document.body.clientHeight/2);');
		writeln('window.moveTo(windowX,windowY);')
		writeln('}');
		writeln('if (isNN){');
		writeln('width=document.images["George"].width;');
		writeln('height=document.images["George"].height;');
		writeln('if(width>maxWidth || height>maxHeight){');
		writeln('if(maxWidth*height/width<=maxHeight){');
		writeln('height=Math.round(maxWidth*height/width);');
		writeln('width=maxWidth;');
		writeln('} else {');
		writeln('width=Math.round(maxHeight*width/height);');
		writeln('height=maxHeight;}}');
		writeln('document.images["George"].width=width;');
		writeln('document.images["George"].height=height;');
		writeln('//window.resizeTo(width,height);');
		writeln('window.innerWidth=width;');
		writeln('window.innerHeight=height;');
		writeln('var windowX=(screen.width/2)-(width/2);');
		writeln('var windowY=(screen.height/2)-(height/2);');
		writeln('window.moveTo(windowX,windowY);')
		writeln('}}');
		if (imageTitle.length>-1) writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');

		if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
		else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');

		writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');

		close();
	}
}

// ------------------------POPUP SETUP - END SCRIPT-------------------------- //

//PHOTO LOADER
function photoLoader(image,iWidth,iHeight){
	var maxWidth=screen.width-110
	var maxHeight=screen.height-110
	 //formatting image within limits
	iWidth=parseInt(iWidth);
	iHeight=parseInt(iHeight);
	if(iWidth>maxWidth || iHeight>maxHeight){
		if(maxWidth*iHeight/iWidth<=maxHeight){	
			iHeight=Math.round(maxWidth*iHeight/iWidth)
			iWidth=maxWidth
		} else {
			iWidth=Math.round(maxHeight*iWidth/iHeight)
			iHeight=maxHeight
		}
	}

	var imageURL=image
	var windowW=iWidth;
	var windowH=iHeight+30;
	// set the screen position where the popup should appear
	var windowX = (screen.width/2)-(windowW/2);
	var windowY = (screen.height/2)-(windowH/2);
	// set this to true if the popup should close
	// upon leaving the launching page; else, false
	var autoclose = true
	var s = "width="+windowW+",height="+windowH;
	//
	var popVDS="photoholder.asp?imageURL="+imageURL+"&width="+iWidth+"&height="+iHeight
	var popWindow=window.open(popVDS,"sitephotos","scrollbars=no,"+s)
	popWindow.blur()
	window.focus() 
	popWindow.resizeTo(windowW,windowH)
	popWindow.moveTo(windowX,windowY)

	popWindow.focus()   
	if (autoclose){
		window.onunload = function(){
			if (popWindow && popWindow.open && !popWindow.closed){
				popWindow.opener = null;
				popWindow.close()
			}
			
		}
	}
}

//VIDEO LOADER
function videoLoader(video){
	if(video.toLowerCase().indexOf("http")>-1){
		var videoURL=video
	} else {
		var videoURL="<%=strRootPath%>"+video
	}
	var windowW=400
	var windowH=400
	// set the screen position where the popup should appear
	var windowX = (screen.width/2)-(windowW/2);
	var windowY = (screen.height/2)-(windowH/2);
	// set this to true if the popup should close
	// upon leaving the launching page; else, false
	var autoclose = true
	var s = "width="+windowW+",height="+windowH;
	//
	var popVDS="video_holder.asp?filename="+video+"&videoURL="+videoURL;
	var popWindow=window.open(popVDS,"sitevideos","scrollbars=no,"+s)
	popWindow.blur()
	window.focus() 
	popWindow.resizeTo(windowW,windowH)
	popWindow.moveTo(windowX,windowY)

	popWindow.focus()   
	if (autoclose){
		window.onunload = function(){
			if (popWindow && popWindow.open && !popWindow.closed){
				popWindow.opener = null;
				popWindow.close()
			}
			
		}
	}
}

//TRACK LOADER
function trackLoader(url,filesize){
	if(url!="" && url!=undefined){
		if(url.indexOf("http")>-1){
			var trackurl=url
		} else {
			var trackurl="<%=strRootPath%>"+url
		}
		var windowW=300
		var windowH=200
		// set the screen position where the popup should appear
		var windowX = (screen.width/2)-(windowW/2);
		var windowY = (screen.height/2)-(windowH/2);
		// set this to true if the popup should close
		// upon leaving the launching page; else, false
		var autoclose = true
		var s = "width="+windowW+",height="+windowH;
		//
		var popVDS="track_holder.asp?trackURL="+trackurl+"&filesize="+filesize
		var popWindow=window.open(popVDS,"sitetracks","scrollbars=no,"+s)
		popWindow.blur()
		window.focus() 
		popWindow.resizeTo(windowW,windowH)
		popWindow.moveTo(windowX,windowY)
	
		popWindow.focus()   
		if (autoclose){
			window.onunload = function(){
				if (popWindow && popWindow.open && !popWindow.closed){
					popWindow.opener = null;
					popWindow.close()
				}
				
			}
		}
	} else {
		alert("Please enter a filename to play");
	}
}

//PAGE POPUP WINDOW SCRIPT
function pageLoader(page,iWidth,iHeight,name){
	// set this to true if the popup should close
	// upon leaving the launching page; else, false
	var autoclose = true
	var maxWidth=screen.width;
	var maxHeight=screen.height;
	//formatting image within limits
	iWidth=parseInt(iWidth);
	iHeight=parseInt(iHeight);
	if(iWidth>maxWidth || iHeight>maxHeight){
		if(maxWidth*iHeight/iWidth<=maxHeight){	
			iHeight=Math.round(maxWidth*iHeight/iWidth);
			iWidth=maxWidth;
		} else {
			iWidth=Math.round(maxHeight*iWidth/iHeight);
			iHeight=maxHeight;
		}
	}
	var windowW=iWidth;
	var windowH=iHeight+25;
	// set the screen position where the popup should appear
	var windowX = (screen.width/2)-(windowW/2);
	var windowY = (screen.height/2)-(windowH/2);
	var s = "width="+windowW+",height="+windowH;
	//name of app
	pageName=name
	//
	var pageVDS=page;
	var pageWindow=window.open(pageVDS,pageName,"scrollbars=no,status=no,"+s);
	pageWindow.blur();
	window.focus();
	pageWindow.resizeTo(windowW,windowH);
	pageWindow.moveTo(windowX,windowY);
	pageWindow.focus();
	
	if (autoclose){
		window.onunload = function(){
			if (pageWindow && pageWindow.open && !pageWindow.closed){
				pageWindow.opener = null;
				pageWindow.close();
			}
			
		}
	}
}
//flash page loader
function flashPageLoad(mPage){
	//list site sections
	var mySections="home,news,sports,community"
	if(mySections.indexOf(mPage)>-1){
		newLoca="/main.asp?sec="+mPage;

		//redirect to open section
		window.location.assign(newLoca);
	} else {
		if(mPage=="intro"){
			window.location.assign("/default.asp?sec=home");
		} else if(mPage=="contacts"){
			window.location.assign("/email_us.asp")
		} else if(mPage=="journal"){
			window.location.assign("/journal/")
		} else if(mPage=="forum"){
			window.location.assign("/forum/")
		} else if(mPage=="guests"){
			window.location.assign("/guestbook/")
		} else if(mPage=="search"){
			window.location.assign("/search.asp")
		} else if(mPage=="gallery"){
			window.location.assign("/photo_gallery.asp")
		} else if(mPage=="site_map"){
			window.location.assign("/site_map.asp")
		} else {
			newLoca="/main.asp?page="+mPage;
			//redirect to open section
			window.location.assign(newLoca);
		}
	}
}
//flash pop-up photo loader
function flashPhotoPopup(fImage,fDim){
	var fWidth=fDim.substring(0,fDim.indexOf("x"));
	var fHeight=fDim.substring(fDim.indexOf("x")+1);
	//load photo
	photoLoader(fImage,fWidth,fHeight);
}
//NEWSLETTER SUBSCRIPTION
function checkEmail(){
	//Check for an e-mail address and that it is valid
	if ((document.frmList.email.value == "") || (document.frmList.email.value.length > 0 && (document.frmList.email.value.indexOf("@",0) == - 1 || document.frmList.email.value.indexOf(".",0) == - 1))) {
  		msg = "____________________________________________________________________\n\n";
		msg += "Your submission has failed because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "____________________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";
		msg += "\n\tEmail Address \t- Please enter your valid email address";
		errorMsg=msg;
		alert(errorMsg);
		document.frmList.email.focus();
		return false;
	} else {
		return true;
	}
}
//SEARCH ENGINE
function checkSearch() {
	var errorMsg = "";
	if (document.frmSearch.search.value==""){
		errorMsg += "\n\tSearch \t- Please enter at least one word to search for";
	}
	if (errorMsg != ""){
		msg = "____________________________________________________________________\n\n";
		msg += "Your Search of our website has failed because there are problem(s) with the form.\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "____________________________________________________________________\n\n";
		msg += "The following field(s) need to be corrected: -\n";

		errorMsg += alert(msg + errorMsg + "\n\n");
		document.frmSearch.search.focus();
	} else {
		if(document.frmSearch.sitesearch.length>-1){
			for(i=0;i<document.frmSearch.sitesearch.length;i++){
				if(document.frmSearch.sitesearch[i].checked){
					sitesearch=document.frmSearch.sitesearch[i].value;
				}
			}
		} else {
			sitesearch=document.frmSearch.sitesearch.value;
		}

		if(sitesearch=="monrepossports" ){
			document.frmSearch.action="search.asp";
			document.frmSearch.method="get";
			document.frmSearch.submit();
		} else {
			searchUrl="google.asp?q=" + document.frmSearch.search.value + "&domains=" + document.frmSearch.domains.value + "&sitesearch=" + sitesearch;
			window.open(searchUrl);
		}
	}
}
//BUTTON TOOLTIP FOR DEFAULT BUTTONS
function buttonTip(section,selected){
	var tipText="vieuxfortsports.org";
	tipText+="<br /><strong>"+section.toUpperCase()+"</strong>";

	//if this is the active site section
	if(selected){
		tipText+="<br />Browse this section with the floating menu above.";
	}

	//show tooltip
	showtip(tipText);
}
//OPEN CHATROOM
function openChat(url){
	chatWindow=window.open(url);
}
//SWAP IMAGE FUNCTIONS
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_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_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];}
}

//CELL BLINK FUNCTIONS FOR GALLERY THUMBNAILS
flag=true
cell=""
function cellBlink(){
	if(document.getElementById!=undefined && flag){
		document.getElementById(cell).style.background="#FFFF00"
		flag=false;
	} else	if(document.getElementById!=undefined && !flag){
		document.getElementById(cell).style.background="#FFFFFF"
		flag=true;
	}
}
function startBlink(thiscell){
	cell=thiscell
	blink=setInterval("cellBlink()",500)
}
function stopBlink(thiscell){
	clearInterval(blink)
	if(document.getElementById!=undefined){
		document.getElementById(thiscell).style.background="#FFFFFF"
	}
}
//LOAD PHOTO DETAILS
function loadPhotoDetails(ID,category,pg){
	//get photo page
	window.location.href="photo_details.asp?ID="+ID+"&category="+category+"&pg="+pg
}