<!--
/*
  -------------------------------------------------------------------------------
 |  The content of this file constitutes Licensed Code.                          |
 |  Copyright (C) 2005-2007 Azalea Technology, LLC. All rights reserved.         |
 |-------------------------------------------------------------------------------|
 |  Unauthorized removal of this notice is considered a violation of the         |
 |  license agreement under which this Code may be used. This work is protected  |
 |  under United States copyright law and the similar law(s) of other countries  |
 |  under which such as work is afforded legal protection, and upon conviction   |
 |  of such a violation in a court of applicable jurisdiction, such person(s)    |
 |  may be subject to the maximum allowable penalty as permitted under such law. |
 |-------------------------------------------------------------------------------|
 |  You acknowledge and agree that information presented to you through this     |
 |  site (the "Web Site") is protected by all applicable copyrights, trademarks, |
 |  service marks, patents or other proprietary rights and laws, and by virtue   |
 |  of accessing the Web Site, except as expressly authorized by the Azalea      |
 |  Technology, LLC., you agree not to modify, rent, lease, loan, sell,          |
 |  distribute, store, or create derivative works based on the Web Site, in      |
 |  whole or in part.                                                            |
  -------------------------------------------------------------------------------|
 |  Decrypting or otherwise decoding the following programming language code is  |
 |  strictly prohibited except as expressly authorized by Azalea Technology,     |
 |  LLC. Upon conviction of such a violation in a court of applicable            |
 |  jurisdiction, such person(s) may be subject to the maximum allowable penalty |
 |  as permitted under such law.                                                 |
  -------------------------------------------------------------------------------
      Purpose: Window function library
   Programmer: B. Roberts
               Azalea Technology, LLC.
               P.O. Box 131150
               Tyler, TX 75713-1150
               903-581-4448
  -------------------------------------------------------------------------------
*/

function show_inquiry_wndow(url){
	var w = 410;
	var h = 468;
	var x = (screen.width-w)/2;
	var y = (screen.height-h)/2;
	var inquiryWindow = window.open(url,"","height="+h+",width="+w+",status=no,scrollbars=yes,resizable=no");
	try{
		inquiryWindow.moveTo(x,y);
		inquiryWindow.focus();
	}
	catch(e){
		// Do Nothing
	}
}

// Accepts 1-3 arguments: target url, windows width, and window height
// Usage: owx(url[,w][,h])
// Description: opens a new window containing the specified url
function owx(){
	var arg_count,x,y,url,h,w;
	arg_count = arguments.length;
	if(arg_count<1) return;
	if(arg_count==1) url = arguments[0];
	else if(arg_count==2){
		url = arguments[0];
		w = arguments[1];
	}
	else if(arg_count>2){
		url = arguments[0];
		w = arguments[1];
		h = arguments[2];
	}
	x = (screen.width-w)/2;
	y = (screen.height-h)/2;
	if(isNaN(x)||x<0) x = 5;
	if(isNaN(y)||y<0) y = 5;
	var nw = window.open(url,"","height="+h+",width="+w+",status=no,scrollbars=yes,resizable=no");
	if(nw.moveTo(x,y));
	if(nw.focus());
}

function count_down(secs, element_id){
	if(secs<=0) return;
	secs-=1;
	write_text_to_element(element_id, secs);
	var id = window.setTimeout("count_down("+secs+", '"+element_id+"')", 1000);
}

function convert_to_milliseconds(secs){
	return (secs * 1000);
}

function redirect(url){
	window.location.href = url;
}

function pause_and_redirect(secs, count_down_timer, url){
	secs = parseInt(secs);
	if(isNaN(secs)) secs = 10;
	var miliseconds = convert_to_milliseconds(secs);
	var id = window.setTimeout("redirect('"+url+"')", miliseconds);
	if(count_down_timer) count_down(secs,'timer_display');
}

//-->