
var ns6=document.getElementById&&!document.all?1:0

var head="display:''"
var folder=''

function expandit(curobj){
folder=ns6?curobj.nextSibling.nextSibling.style:document.all[curobj.sourceIndex+1].style
if (folder.display=="none")
folder.display=""
else
folder.display="none"
}

function disableForm(theform) {
	if (document.all || document.getElementById) {
		for (i = 0; i < theform.length; i++) {
			var tempobj = theform.elements[i];
			if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
				tempobj.disabled = true;
			}
			setTimeout('alert("Your form has been submitted.  Notice how the submit and reset buttons were disabled upon submission.")', 2000);
			return true;
		}
	else {
		alert("The form has been submitted.  But, since you're not using IE 4+ or NS 6, the submit button was not disabled on form submission.");
		return false;
   	}
}


function returnObjById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}

function checkCheckBox(cb){
	box = returnObjById(cb);
	box.checked = true;
}

var color = '';
function mouseover(id,hexcolor) {
    if (document.getElementById) {
        color = document.getElementById(id).style.backgroundColor;
        document.getElementById(id).style.backgroundColor = hexcolor;
				document.getElementById(id+'_a').style.color = "#ffffff";
    }
    else if (document.layers) {
        color = document.layers[id].bgColor;
        document.layers[id].bgColor = hexcolor;
				document.layers(id+'_a').color = "#ffffff";
    }
    else if (document.all) {
        color = document.all[id].style.background;
        document.all[id].style.background = hexcolor;
				document.all[id+'_a'].style.color = "#ffffff";
    }

}

function mouseout(id) {
    if (document.getElementById){
        document.getElementById(id).style.backgroundColor = color;
				document.getElementById(id+'_a').style.color = "#000000";
		}
    else if (document.layers){
        document.layers[id].bgColor = color;
				document.layers(id+'_a').color = "#000000";
		}
    else if (document.all){
        document.all[id].style.background = color;
				document.all[id+'_a'].style.color = "#000000";
		}
}

function toggleLayer( whichLayer )
{
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work
		elem = document.getElementById( whichLayer );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[whichLayer];
	else if( document.layers ) // this is the way nn4 works
		elem = document.layers[whichLayer];
	vis = elem.style;  // if the style.display value is blank we try to figure it out here
	if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
		vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
	vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}




function UpdateCart(divID,CompanyID,Action,path,type) {
	document.getElementById("CartContainer").style.display = "block";
	var divEditID = divID;
	var url = path+'/franchise/cooksave';

	//var params = 'cartCompanyID=' + CompanyID + '&action=' + Action ;// Used to get the value of a form field -> $F('zip')
	//alert(params)
	//var ajax = new Ajax.Updater({success: divEditID},url,{method: 'post', parameters: params});
    doAjax(url+'/rand/'+ Math.random() +'/franid/'+CompanyID+'/type/'+type+'/actions/'+Action,'','franchesfunc','GET');
}
function franchesfunc(item)
{
  document.getElementById("CartContainer").innerHTML=item;
}

function UpdateHistory(divID,CompanyID,Action) {
	var divEditID = divID;
	var url = '/Includes/FranchiseHistory.html';
	var params = 'CompanyID=' + CompanyID + '&action=' + Action ;// Used to get the value of a form field -> $F('zip')
	//alert(params)
	var ajax = new Ajax.Updater({success: divEditID},url,{method: 'post', parameters: params});
}

function AddCartItemToDOM(txt,lnk,id){
		//if(document.getElementById('CartEndRow')){
			var cell = document.getElementById('CartEndRow');
			cell.parentNode.removeChild(cell.parentNode.lastChild);
		//}


		parentNode = document.getElementById('CartListUL');
		ItemLI=document.createElement('li');
		ItemA=document.createElement('a');
		ItemA.setAttribute('href',lnk);
		ItemText=document.createTextNode(txt);
		parentNode.appendChild(ItemLI);
		ItemLI.appendChild(ItemA);
		ItemA.appendChild(ItemText);


		ItemLI2=document.createElement('li');
		ItemLI2.setAttribute('id','CartEndRow');
		ItemA2=document.createElement('a');
		ItemText2=document.createTextNode('  ');
		parentNode.appendChild(ItemLI2);
		ItemLI2.appendChild(ItemA2);
		ItemA2.appendChild(ItemText2);
		ReInit();
}

function RemoveCartItemToDOM(id){
		//if(document.getElementById('CartEndRow')){
		try{
			var cell;
			cell = document.getElementById(id);
			cell.parentNode.removeChild(cell);
		}catch(err){

		}
		//}
		ReInit();
}


function removeChildrenFromDOM(id){
	try{
		var cell = document.getElementById(id);
		if ( cell.hasChildNodes() ){
				while ( cell.childNodes.length >= 1 ){
						cell.removeChild( cell.firstChild );
				}
		}
	}catch(err){

	}
}

function AddToCartEffects(objToFold){
	try{
		new Effect.Squish(objToFold,{"duration":"0.7"});
		//new Effect.Highlight("CartContainer",{ "startcolor": "#FF0000","endcolor": "#FFFFFF","restorecolor": "#FFFFFF","duration":"2.0" } );
	}catch(err){
		//nothing
	}
}

function AddToCartEffects2(Ojb){
	try{
		new Effect.Highlight(Ojb,{ "startcolor": "#FF0000","endcolor": "#FFFFFF","restorecolor": "#FFFFFF","duration":"2.0" } );
	}catch(err){
		//nothing
	}
}

function emailForm(emailPrefix,subject,domain){
	var email = emailPrefix+"@" + domain + ".com";
	var mailto_link = 'mailto:'+email+'?subject='+subject;
	//output
	document.write('<a href=\"' + mailto_link + '\">');
	document.write(email + '</a>');
}



/*Cart*/

function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;

	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}

	var scrollArray = [scrOfX, scrOfY];

	return scrollArray;
}

	var isIE6 = (navigator.appVersion.indexOf("MSIE")!=-1 && parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+5))<7);
	function moveRequestList(){

		var franchiseRequestListObj = document.getElementById("CartContainer");

		//franchiseRequestListObj.style.display = "block";

		//var franchiseListContentObj = document.getElementById("franchiseList");
		//var previousSpotArray = findPosition(franchiseRequestListObj)
		var scrollArray = getScrollXY();
		var scrollerOffset = 1;
		var startScroll = 1;
		if(scrollArray[1] < startScroll){
			//franchiseListContentObj.innerHTML = previousSpot + " " + scrollArray[1];
			if(!isIE6)
				franchiseRequestListObj.style.position = "fixed";
			else
				franchiseRequestListObj.style.position = "absolute";
			franchiseRequestListObj.style.top =scrollerOffset + "px";
			previousSpot = scrollerOffset;

		} else {
			//alert(scrollArray[1]);
			//franchiseListContentObj.innerHTML = previousSpot + " " + scrollArray[1];
			if(isIE6) {
				franchiseRequestListObj.style.top = (scrollArray[1] + ( startScroll)) + "px";
			} else{
				franchiseRequestListObj.style.position = "fixed";
				franchiseRequestListObj.style.top = scrollerOffset - startScroll +"px";
			}

			previousSpot = scrollArray[1];
			//t1 = new Tween(franchiseRequestListObj.style,'top',Tween.regularEaseIn,previousSpot,(scrollArray[1]),1,'px');
			//t1.start();
			//previousSpot = scrollArray[1];
		}
	}


function toggleRequestList(){
    document.getElementById("CartContainer").style.display = "none";
	/*if(IsRequestInfoOpen){

		document.getElementById("CartContainer").style.display = "none";
		//document.getElementById("ToggleRequest").innerHTML = "+ Show Request List";
		IsRequestInfoOpen = 0;
	}
	else {
		document.getElementById("CartContainer").style.display = "block";
		//document.getElementById("ToggleRequest").innerHTML = "- Hide Request List";
		IsRequestInfoOpen = 1;
	}*/
}




//new



