<!--

var fldname;
var fname;
var fieldname;
var allowedlength;
var minlength;

function help(id, urlprefix) {
	if(typeof procid != "undefined"){
		if(urlprefix){
			var url = urlprefix + "help.aspx?id=" + id + "&procid=" + procid;         
		}
		else{
			var url = "help.aspx?id=" + id + "&procid=" + procid;      
		}
		window.open(url,'window_open','height=200,width=300,toolbar=no,status=yes,scrollbars=yes,resizable=yes,menubar=no');
	}else{
		alert("Error: process ID undefined")
	} 
}

function helpLarge(id, urlprefix) {
	if(typeof procid != "undefined"){
		if(urlprefix){
			var url = urlprefix + "help.aspx?id=" + id + "&procid=" + procid;         
		}
		else{
			var url = "help.aspx?id=" + id + "&procid=" + procid;      
		}
		window.open(url,'window_open','height=600,width=650,toolbar=no,status=yes,scrollbars=yes,resizable=yes,menubar=no');
	}else{
		alert("Error: process ID undefined")
	} 
}

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_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) { //v3.0
  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); 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];}
}

var NewWin=null;
function NewWindow(Winpage,Winname,w,h,pos,infocus){
if(pos=="random"){Winleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;Wintop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){Winleft=(screen.width)?(screen.width-w)/2:100;Wintop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null){Winleft=0;Wintop=20}
settings="width=" + w + ",height=" + h + ",top=" + Wintop + ",left=" + Winleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";NewWin=window.open(Winpage,Winname,settings);
NewWin.focus();}
	
function printit(){  
	if (NS) {
		window.print() ;  
	} else {
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
	}
}

function confirm_delete(itemname)
{
  if (confirm("Are you sure you want to delete this " + itemname + "?")==true)
    return true;
  else
    return false;
}
function confirm_wizardnav()
{
	if (confirm("Are you sure you want to skip this step? Any changes you have made to this page will not be saved!")==true)
		return true;
	else
		return false;
}
function confirm_skipwizard()
{
	if (confirm("Are you sure you want to skip the New Ad Wizard completely?")==true)
		return true;
	else
		return false;
}
function confirm_accept()
{
  if (confirm("By accepting you agree to sell the item to this buyer for the agreed upon price.  The buyer will be notified of your acceptance and the item will no longer be available for sale.\n\nAll other offers will be rejected and those users notified that they did not win.\n\nAre you sure you want to accept this offer?")==true)
    return true;
  else
    return false;
}
function confirm_close()
{
  if (confirm("Closing will reject all offers and all buyers will be notified of the rejection.  Optionally, you can enter a buyer e-mail if the item sold outside of the system.  Once you close an item you can not re-open it.  Are you sure you wish to close this item?")==true)
    return true;
  else
    return false;
}
function confirm_reject()
{
   reason = prompt("Please enter your rejection reason.  The buyer will be notified.\n1. Offer too low.    2. Poor buyer feedback.    3. Item already sold.", "1");
	if (reason == null ){ // Cancel pressed 
	return false; 
	} 
	else if  (reason == "1" || reason == "2" || reason == "3"){ // OK pressed but no text 
	document.frmMain.txtReason.value = reason
	return true; 
	} 
	else 
	{// OK pressed and theres something entered 
	alert("You did not enter a valid reason.")	
	return false; 
 
	}
}
function confirm_bid()
{
  if (confirm("You are agreeing to a legally binding contract to buy this item from the seller in the event that you are the winning bidder.\n\nDo you want to continue?")==true)
    return true;
  else
    return false;
}
function confirm_order()
{
  if (confirm("You are agreeing to a legally binding contract to buy this item from the seller.\n\nDo you want to continue?")==true)
    return true;
  else
    return false;
}

// timer functions for page expiration
var endTimeAlert = null
var timerID = null
var endTimeRedir = null
var alertMsg
var URLtimeout
var alertExpired = null

function runTimer(msgAlert, timeoutURL, alertTime, redirTime){
	alertMsg = msgAlert
	URLtimeout = timeoutURL
	
	now = new Date()
	now = now.getTime()
	
	// Set the duration here
	endTimeAlert = now + (1000 * 60 * alertTime)
	endTimeRedir = now + (1000 * 60 * redirTime)
	
	startTimer();
	}

function startTimer() {
	
	var now = new Date()
	now = now.getTime()
	
	if (endTimeAlert - now <= 0 &! alertExpired) {
		alert(alertMsg);
		alertExpired = true;
		timerID = setTimeout("startTimer()",1000);
	} else if (endTimeRedir - now <= 0){
		location.href = URLtimeout
		}
	 else {
		timerID = setTimeout("startTimer()",1000);
		}
		
	}

//Function to increment counter showing remaining number of characters available in form field
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}else{
		countfield.innerHTML = maxlimit - field.value.length;
	}
}

//Check specified text field for HTML tags and return true or false
function htmlCheck(field,fieldName){
	if (!fieldName){
		fieldName = "text";
	}

	var regEx = new RegExp("<(.|\n)*?>");
	var msg = "It appears you may have HTML formatting in your " + fieldName + ".\n\n";
	msg += "Any invalid HTML tags will be automatically removed from your text prior to it being placed online.\n\n";
	msg += "At this time the system only allows the following HTML tags: <br>, <p></p>, <b></b>, <u></u>, <ol></ol>, <li></li>.\n\n";
	msg += "All other tags will be removed.Click 'OK' to continue or 'Cancel' to go back and edit your text."
	regEx.multiline = true;
	if (regEx.test(field.value)) {
		if (window.confirm(msg)) {
			return true;
		}else{
			field.focus();
			return false;
		}
	}
}
//-->
