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

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

	var imageURL=image
	var windowW=width
	var windowH=height
	// 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="+width+"&height="+height
	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()
			}
			
		}
	}
}
//PAGE POPUP WINDOW SCRIPT
function pageLoader(page,width,height,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
	if(width>maxWidth || height>maxHeight){
		if(maxWidth*height/width<=maxHeight){	
			height=Math.round(maxWidth*height/width);
			width=maxWidth;
		} else {
			width=Math.round(maxHeight*width/height);
			height=maxHeight;
		}
	}
	var windowW=width;
	var windowH=height;
	// 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();
			}
			
		}
	}
}
//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=="relinjo"){
			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="relinjo.com";
	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);
}

//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];}
}