//<!--
function AffiliateSignUp(theObject){
	
	dform.action = "index.asp?PageMode=" + theObject.id
	dform.method = "post"
	dform.submit()
}

function AreaLogic(theObject){
	
	var StateID = theObject.options[theObject.selectedIndex].value
	document.frmHidden.StateID.value = StateID
	document.frmHidden.flag.value = "new_state_selection"
	document.frmHidden.action = "/includes/BackEndProcess.asp"
	document.frmHidden.submit()
	//document.Process_Frame.location.href = "/includes/BackEndProcess.asp?flag=new_state_selection&StateID=" + StateID

}	

function AddTerritory(theObject){
//alert("You must first select an area.")
	if (document.dform.CountyName.options.value==""){
		alert("You must first select an area.")
		} 
	else 
		{
		if (document.dform.CountyName.options[document.dform.CountyName.options.selectedIndex].style.background == "gainsboro")
			{
			alert("The selected territory is already taken, please select another, \nor you can purchase a Limited Membership by calling (800)574-9221. \n\nThank You")
			}
		else
			{
			theSelectedValue = document.dform.CountyName.options.value
			theSelectedText = document.dform.CountyName.options[document.dform.CountyName.options.selectedIndex].text
			theSelectedCounty = document.forms['dform'].elements['SelectedCounty']
			
			theAlreadyInserted = false
	
			for (i=0;i<theSelectedCounty.length;i++){
				if (theSelectedValue ==theSelectedCounty.options[i].value){
					alert("This option has already been added to the list!")
					theAlreadyInserted = true
				}
			}
			if (!theAlreadyInserted){
	
				//if (dform.CountyName.options.value != -1)
				theNewOptions = new Option(theSelectedText,theSelectedValue)
				theSelectedCounty.options[theSelectedCounty.length] = theNewOptions
			}
				var x = ""
				for (i=0;i<theSelectedCounty.length;i++){
					x = x + theSelectedCounty.options[i].value + ", "
				}			
				dform.Territories.value = x		
			}
		}
}
function Remove(theObject){
theSelectedCounty = document.forms['dform'].elements['SelectedCounty']


if (document.dform.SelectedCounty.selectedIndex != -1){
//alert(document.dform.SelectedCounty.options.selectedIndex)
document.dform.SelectedCounty.options.remove(document.dform.SelectedCounty.options.selectedIndex)
}
}

function Login(theObject){
	
	window.location = "index.asp?PageMode=LOGIN"
	
}

function ContactAffiliate(theObject){
	window.location = "../AffiliateListing/index.asp?CountyID=" + theObject.options.value
}

function SetTerritories(theObject){
	
	theSelectedCounty = document.forms['dform'].elements['SelectedCounty']
	var x = ""
	for (i=0;i<theSelectedCounty.length;i++){
		x = x + theSelectedCounty.options[i].value + ", "
	}
	dform.Territories.value = x
/*	
	alert(dform.Territories.value)
*/	
	//dform.method = "post"
	//dform.action = "Processing.asp?PageMode=STEP2"
	//dform.submit()

}


	var pos=120;
function Scroll() {

	if (!document.getElementById) return;
	obj=document.getElementById("thetext");
	pos -=1;
	
	if (obj){	
		if (pos < 0-obj.offsetHeight+50) return;
		obj.style.top=pos;  

		window.setTimeout("Scroll();",55);
		if (pos < -200)
			pos=120	
	}

}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	alert("TET")
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		index_03_over = newImage("/images/index_03-over.gif");
		index_04_over = newImage("/images/index_04-over.gif");
		index_05_over = newImage("/images/index_05-over.gif");
		index_06_over = newImage("/images/index_06-over.gif");
		preloadFlag = true;
	}
}
function RunValidate(theObject){
	
	var theForm = document.getElementById("dform")
	
	Validator(theObject)
	
	return false
}
window.status = "WeBuyHousesForCash.com $$$ $$$ $$$ $$$ "

function CheckPicture(){

	if (document.upLoad.ContentName.value == "" ){
		//alert("Please give picture a name")
	} else {
		//return true
	}
		
//	if (document.getElementById ("ContentName").value <> ""){
//		return true
//	} else {
//		return false
//	}

}


// -->
