
// EDITOR
_editor_url = "/htmlarea/";
_editor_lang = "en";


// PAGE TIMEOUT
if (document.layers) {
  window.captureEvents(Event.MOUSEMOVE);
}

var tID = '';


//==============================================
// Popup
//==============================================
function popUpGallery(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=660,height=700,left = 590,top = 275');");
}


//==============================================
// Clear Box
//==============================================
function clearBox(inputbutton, fillValue){
	if (inputbutton.value==fillValue) {
		inputbutton.value=''
	}
}
function fillBox(inputbutton, fillValue){
	if (inputbutton.value=="") {
		inputbutton.value=fillValue
	}
}
//==============================================

//==============================================
//Link Delete
//==============================================
function delete_imageCheck(sURL) {
	
	var sType
	var sItem
	var confirmDelete = confirm("Remove this image?")
	if (confirmDelete == true) {
		document.location = sURL
	}
	else {
		
	}
}

//==============================================


//==============================================
//Quick Nav Submit
//==============================================
	function DropCheck(optionObj) {
		//alert(optionObj.options[optionObj.selectedIndex].value);
		if (optionObj.options[optionObj.selectedIndex].value != '') 
		window.location.href = optionObj.options[optionObj.selectedIndex].value;
	}
//==============================================

//==============================================
//Error Handler
//==============================================
function errorhandler() { 
	return true; 
}
//window.onerror=errorhandler;
//==============================================


//==============================================
//CHECK Object Existence
//==============================================
function testIsValidObject(objToTest) {
		if (null == objToTest) {
			return false;
		}
		if ("undefined" == typeof(objToTest) ) {
			return false;
		}
		return true;

	}
//==============================================

//==============================================
// HAD TO CHANGE TO 1 because of overall search
// Delete Check
//==============================================
function deleteCheck(sURL) {
	var confirmDelete = confirm("Are you sure you want to delete this item? \n ")
	if (confirmDelete == true) {
		document.forms[1].action = sURL + '?SubmitButton=Delete'
		document.forms[1].submit();
	} 
	return false;
}


function deleteallgearCheck(sURL) {
	var confirmDelete = confirm("WARNING: YOU HAVE CHOOSEN TO DELETE All GEAR\n\nThis means that all pieces of gear will be removed from the system.\n\n   Cick OK to DELETE all Gear\n   Click CANCEL to abort \n")
	if (confirmDelete == true) {
		document.forms[1].action = sURL + '?SubmitButton=removeallgear'
		document.forms[1].submit();
	} 
	return false;
}
//==============================================



//==============================================
//Link Delete
//==============================================
function linkdeleteCheck(sType, sItem, sURL) {
	
	var sType
	var sItem
	var confirmDelete = confirm("Delete This Item?")
	if (confirmDelete == true) {
		document.location = sURL + '?PM=delete' + sType + '&' + sType + '=' + sItem
	}
	else {
		
	}
}
//==============================================

//==============================================
//Link Delete wishlist
//==============================================
function linkdelete_wishlist(sURL) {
	
	var sType
	var sItem
	var confirmDelete = confirm("Remove this item from wishlist?")
	if (confirmDelete == true) {
		document.location = sURL
	}
	else {
		
	}
}

//==============================================

//==============================================
//Add Category Check
//==============================================
function AddGearTypeCheck(sGearTypeButton, sText, sURL) {

	var sCategory = document.forms.GearTypeForm.GearType.value
	if (sCategory  != '') {
		document.forms.GearTypeForm.action = sURL + '?SubmitButton=' + sGearTypeButton
		document.forms.GearTypeForm.submit();
	} 
	else {
		alert('You Must Enter an ' + sText);	
	}
	return false;
}
//==============================================

//==============================================

function GearTypedeleteCheck(sType, sItem, sItem2) {
	
		var sType
		var sItem
		var confirmDelete = confirm("Delete This Item?")
		if (confirmDelete == true) {
			document.location = '/admin/geartype.asp?SubmitButton=delete' + sType + '&' + sType + '=' + sItem + '&GearType_Id=' + sItem2
		}
		else {
		}
	}
	

	
//==============================================

//==============================================
// Delete gear check
//==============================================
function deleteGearCheck(iIdGear) {
		var confirmDelete = confirm("Are you sure you want to Delete This Item?")
		if (confirmDelete == true) {
		document.location = '/dealer/gear.asp?SubmitButton=delete&Gear_Id=' + iIdGear
		}
		else {
		}
	}

	
//==============================================

//==============================================
// Delete gear check
//==============================================
function soldGearCheck(iIdGear) {
		var confirmDelete = confirm("Would you like to change the Sold Status of this item?")
		if (confirmDelete == true) {
		document.location = '/dealer/gear.asp?SubmitButton=sold&Gear_Id=' + iIdGear
		}
		else {
		}
	}

	
//==============================================

//==============================================
//Gear Popup
//==============================================
function popupUploadGear(sLink) {
		var popupWin
		popupWin = window.open (sLink, '400x400', 'toolbar=no,location=no,status=no,directories=no,menubar=yes,scrollbars=yes,resizable=no,width=560,height=600');
		popupWin.opener.top.name ="windowOpener";
		popupWin.focus();
	}


//==============================================
//Gear Popup
//==============================================
function popupGearImage(sLink) {
		var popupWin
		popupWin = window.open (sLink, '650x425', 'toolbar=no,location=no,status=no,directories=no,menubar=yes,scrollbars=yes,resizable=no,width=650,height=425');
		popupWin.opener.top.name ="windowOpener";
		popupWin.focus();
	}


//==============================================
//printer Popup
//==============================================
function popupRequestInfo(iIdGear) {
		var popupWin
		popupWin = window.open ('request_info.asp?Gear_Id=' + iIdGear, '400x400', 'toolbar=no,location=no,status=no,directories=no,menubar=yes,scrollbars=yes,resizable=no,width=520,height=300');
		popupWin.opener.top.name ="windowOpener";
		popupWin.focus();
	}

	
//==============================================
//Generate Popup
//==============================================
function popitup(url) {
		newwindow=window.open(url,'name','height=630,width=840');
		if (window.focus) {newwindow.focus()}
		return false;
	}
	
	
//==============================================
//Generate Popup
//==============================================
function popupOrder(iOrderId) {
		var popupWin
		popupWin = window.open ('/dealer/dealer_order_details_printer.asp?Order_Id=' + iOrderId, '400x400', 'toolbar=no,location=no,status=no,directories=no,menubar=yes,scrollbars=yes,resizable=no,width=560,height=600');
		popupWin.opener.top.name ="windowOpener";
		popupWin.focus();
	}

//==============================================
//Generate Popup
//==============================================
function popupOrderUser(iOrderId) {
		var popupWin
		popupWin = window.open ('/order_confirmation_printer.asp?Order_Id=' + iOrderId, '400x400', 'toolbar=no,location=no,status=no,directories=no,menubar=yes,scrollbars=yes,resizable=no,width=560,height=600');
		popupWin.opener.top.name ="windowOpener";
		popupWin.focus();
	}
	
//==============================================
//Generate Popup
//==============================================
function popupOrderAdmin(iOrderId, sUser_Username) {
		var popupWin
		popupWin = window.open ('/admin/order_details_printer.asp?Order_Id=' + iOrderId + '&User_Username=' + sUser_Username, '400x400', 'toolbar=no,location=no,status=no,directories=no,menubar=yes,scrollbars=yes,resizable=no,width=560,height=600');
		popupWin.opener.top.name ="windowOpener";
		popupWin.focus();
	}
	
//==============================================
//Generate Popup
//==============================================
function popupGearUser(iGearId) {
		var popupWin
		popupWin = window.open ('/gear_details_printer.asp?Gear_Id=' + iGearId + '&Submitbutton=print', '400x400', 'toolbar=no,location=no,status=no,directories=no,menubar=yes,scrollbars=yes,resizable=no,width=650,height=600');
		popupWin.opener.top.name ="windowOpener";
		popupWin.focus();
	}
	
	
	
	
	
function printThread(iL1, iCategory) {
	window.open('forums_print.asp?I=' + iL1 + '&C=' + iCategory,'ncal', 'toolbar=no,location=no,status=no,directories=no,menubar=yes,scrollbars=yes,resizable=no,width=560,height=600');
}

function emailThread(iL1, iCategory) {
	window.open('forums_email.asp?I=' + iL1 + '&C=' + iCategory,'ncal','width=500,height=500,toolbar=no,location=no,scrollbars=yes');
}

//==============================================
//Text Counter
//==============================================
function textCounter(field, countfield, limit) {
	if (field.value.length > limit)
		field.value = field.value.substring(0, limit);
	
	else 
	countfield.value = limit - field.value.length;
}


//==============================================
//PICK IMAGE
//==============================================
//function image() {
//};
//
//image = new image();
//number = 0;
//
//image[number++] = "<%=sButton1%>"
//image[number++] = "<script language=javascript type=text/javascript src=/_includes/flash_detect.js><%=vsfunction getFlashVersion() { return null; };</script><script language='javascript' type='text/javascript'>var requiredVersion = 5;var flashVersion = getFlashVersion();var haveFlash = '<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='180' height='86' id='banner' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name=wmode value=transparent><param name='movie' value='/banner.swf' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='/banner.swf' wmode='transparent' quality='high' bgcolor='#ffffff' width='180' height='86' name='banner' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>var haveNoFlash = '<a href='/aboutus_freeissue.asp'><img src='/images/dgn_freebanner.gif' width='180' height='86' border='0' alt=''></a>if (flashVersion >= requiredVersion) {document.write(haveFlash);}else if (flashVersion >= 0) {document.write(haveNoFlash);}else if (flashVersion == 0) {document.write(haveFlash);}else if (flashVersion == flashVersion_DONTKNOW || flashVersion == null) {document.write(haveNoFlash);}</script>"
//
//increment = Math.floor(Math.random() * number);
//
//function changeContent(id,shtml) {
//   if (document.getElementById || document.all) {
//      var el = document.getElementById? document.getElementById(id): document.all[id];
//      if (el && typeof el.innerHTML != "undefined") el.innerHTML = shtml;
//   }
//}
