
/*
 * Copyright (c) 2005-2006, The Cito Group & Ryan Ausanka-Crues
 * All rights reserved.
 * Redistribution and use in source and binary forms, with or without
 * modification, are NOT premitted without written permission from
 * THE CITO GROUP or Ryan Ausanka-Crues.
 *
 * THIS SOFTWARE IS PROVIDED BY THE CITO GROUP AND CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE CITO GROUP AND CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
//
//   name: popup()
// params: str        - string to be text in new page
//         new_title  - title of popup window
//         new_width  - width of popup window
//         new_height - height of popup window
//         is_scroll  - whether or not popup window is scrollable
//         new_name   - name of the new window
// return: false - I don't know why, it just does
//   desc: This function creates a new window with the specified
//         values.
//   TODO: This function doesn't appear to be working right now
//         Clicking on the pop-up link doesn't work. - RAC 8/18/05
function popup(str, new_title, new_width, new_height, is_scroll, new_name)
{
  attribStr   = "scrollbars=" + is_scroll + ",width=" + new_width + 
  							", height=" + new_height + ", resizable=no, status=no," +
  							" location=no, toolbar=no, menubar=no";
  w = open("", new_name, attribStr);
  w.document.writeln('<html><head>');
  w.document.writeln('<title>' + new_title + '</title>');
  w.document.writeln('<LINK REL="stylesheet" TYPE="text/css" HREF="/css/main.css">');
  w.document.writeln('</head>');
  w.document.writeln('<body bgcolor="#000000" TOPMARGIN=10 onBlur="self.close();" onLoad="self.focus();">');
  w.document.writeln('<center>' + str + '</center>');
  w.document.writeln('</body></html>');
  w.document.close();
  return false;
}

//
//   name: checkError()
// params: form - form to check if valid for submission
// return: true if the form is valid
//         false if the form needs to be fixed before submission
//   desc: This function checks critical fields to ensure they have
//         been properly filled out prior to submission. It does not allow
//         submission if the form was improperly filled out.
function checkError(form)
{
	// If the price field is empty (length == 0), the form cannot be
	// ...submitted
	if(form.price1.value.length == 0)
	{
		// Error warning
		alert("Please enter a price");
		return false;
	}
	
	// Form has been filled out properly, return true
	else
	{
		return true;
	}
}

//
//   name: getWindowWidth() 
// params: none
// return: width of the current window
//   desc: Figure out the window width no matter what browser the
//         client is using
function getWindowWidth()
{
	var ww = 0;
	d = document;
	
	// If the browser is NN or Opera
	if ( typeof window.innerWidth != 'undefined' )
		ww = window.innerWidth;
		
	else
	{
		if (d.documentElement
				&& typeof d.documentElement.clientWidth!='undefined'
				&& d.documentElement.clientWidth != 0)
			ww = d.documentElement.clientWidth;
		else
			if ( d.body && typeof d.body.clientWidth != 'undefined' )
				ww = d.body.clientWidth;
			else
				alert ("Can't identify window width - please tell me which browser you are using.")
	}
	return ww;
}

