<!--
//=======================================================
// ChiroTouch Generic JS 
// Copywright 2004 all rights reserved
// Author: Ryan Stenberg
// Authorization: ChiroTouch has the written consent to utilize and change these Java scripts indefinitely by Ryan Stenberg.
// Updated: Aug 8 2006
//=======================================================
		


//=======================================================
// Popup window Script
//=======================================================
	function pop_window(url,wd,ht,scl) {
			leftPos = 0;
			topPos = 0;
			if (screen) {
				leftPos = (screen.width / 2) - (wd / 2);
				topPos = (screen.height / 2) - (ht / 2);
			}
		ElementWindow = window.open(url,'DemoForm','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars='+scl+',resizable=yes,width='+wd+',height='+ht+',left='+leftPos+',top='+topPos);
		}
	
	
//=======================================================
// Location Jump Script
//=======================================================

	function go_to(site){
		window.location=site;
	}
	
	
//=======================================================
// Test and output screen resolution script
//=======================================================

function resTest(){
ht=screen.height;
wt=screen.width;
var screenres=0;
val=0;
if (ht>=600||wt>=800){val='/images/ResOK.gif';var screenres =1;}
else{val='/images/ResSmall.gif';var screenres =2;}
document.write('<strong>Your Resolution:</strong>'+wt+'x'+ht+'<img src="'+val+'" />');
return;}


//=======================================================
// Hide Form Mail
//=======================================================
function hideformmail(){
addr='ryan';
			 dom='chiro-touch';
			 dot='com';
			 hdmail = addr+'@'+dom+'.'+dot;
			 document.write = '<input name="recipient" type="hidden" value="'+hdmail+'">';}


//=======================================================
// Hide email Script
//=======================================================
	function hidemail(addr, dom, dot, txt){

		if (txt){
			hdmail = '<a href="mailto:'+addr+'@'+dom+'.'+dot+'">'+ txt +'</a>';}
			
		else{
			hdmail = '<a href="mailto:'+addr+'@'+dom+'.'+dot+'">'+addr+'@'+dom+'.'+dot+'</a>';}
		
		document.write(hdmail);
	}


//=======================================================
//Breadcrumb Script
//=======================================================

function breadcrumbs(PGname, sClass, sDelimiter){
    if(!sDelimiter) sDelimiter = '>';
    var sURL = (location.pathname.indexOf('?') != -1) ? location.pathname.substring(0, location.pathname.indexOf('?')) : location.pathname;
        sURL = (location.pathname.charAt(0) == '/') ? location.pathname.substring(1) : location.pathname;
    	  var nURL = (location.pathname.indexOf('?') != -1) ? location.pathname.substring(0, location.pathname.indexOf('?')) : location.pathname;
        nURL = (location.pathname.charAt(0) == '/') ? location.pathname.substring(1) : location.pathname;
		 
		 //document.write(sURL.lastIndexOf("/"));
		 //document.write(sURL.length);
		 if((sURL.lastIndexOf("/")+1)==sURL.length){  //if folder loose the extra comma at the end of the string
		 sURL = sURL.substring("",sURL.lastIndexOf("/"));}
		 
		 //if (sURL.indexOf("_")!= -1){
			// var newURL = sURL;
		// while (newURL.indexOf("_") != -1){
						//newURL = newURL.replace("_"," ");
					//}}
					//if (newURL.indexOf("And")!= -1){
		// while (sURL.indexOf("_") != -1){
						//newURL = newURL.replace("And","&amp;");
					//}
		 
	var aURL = sURL.split('/');
	//var newURL = newURL.split('/');
	if(aURL){
		
	var sOutput = ('<strong style="color:Black;">You are Here: </strong>');
		
		if (aURL.length==1){ //if file in root allows you to insert custom title with PGame varable
			//  if (PGame){
				  sOutput += PGname;//}
			//else {sOutput += Document.title}  
		}
		
		else{  
			sOutput += '<a href="/">Home</a> >';
  			var sPath = '/';
			
			for(var i = 1; i< aURL.length; i++){ //Crumb Maker, I set it to one because my page files are behind a file called "Pages" in the root of the site.
					
				if (((aURL.length)-1)==i){  //Handle last crumb to have no link properties.
					if((nURL.lastIndexOf("/")+1)==nURL.length){ //Handle last crumb if it is a File with index.
						if (aURL[i].indexOf("_")!= -1){
							while (aURL[i].indexOf("_") != -1){
								aURL[i] = aURL[i].replace("_"," ");}
						}
						if(aURL[i].indexOf("And")!= -1){
						aURL[i] = aURL[i].replace("And","&amp;");}
						
						sOutput += aURL[i];}
					else{ //Handle last crumb with file extension
						
						if (aURL[i].indexOf("_")!= -1){
							while (aURL[i].indexOf("_") != -1){
								aURL[i] = aURL[i].replace("_"," ");}}
								
						if(aURL[i].indexOf("And")!= -1){
							aURL[i] = aURL[i].replace("And","&amp;");}
						
						var lURL = aURL[i].split('.'); 
					sOutput += lURL[0];}}
					
				else{ //Main Loop
					if (sPath.length<2){
					sPath += 'Pages/'+ aURL[i] + '/';} //attach Pages folder to href for proper linking
					else{
						sPath += aURL[i] + '/';} //If Pages folder is already in href move on to next subfolder/page
					sOutput += '<a href="' + sPath + '"';
					if(sClass) {sOutput += ' class="' + sClass +'"';}
			   		 
					if (aURL[i].indexOf("_")!= -1){
					while (aURL[i].indexOf("_") != -1){
						aURL[i] = aURL[i].replace("_"," ");}
						}
										 
					if(aURL[i].indexOf("And")!= -1){
						aURL[i] = aURL[i].replace("And","&amp;");}
					
					 sOutput += '> ' + aURL[i] + ' </a>';
					sOutput += ' ' + sDelimiter + ' ';
					}
			  }
		}
	document.write(sOutput);
	}
}


//=======================================================
//Cookie Scripts
//=======================================================

function getCookie(c_name){
	
if (document.cookie.length>0){
	
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1){ 
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
	if (c_end==-1){ 
		c_end=document.cookie.length;}
		
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return null

}
//===============Set Cookies===================
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; path=/; expires="+exdate);
}

//===============Check Cookies==================
function checkDemoCookie(c_name, jump, if_false, if_true){
make_c = c_name;
c_name=getCookie(c_name);

if (c_name!=null){
	if(if_true!='break'){
	  window.location=if_true;}}

else {
	if (if_false!='break'){
  	if (jump=='yes'){
	  	setCookie(make_c,'1',365);}
	  window.location=if_false;}}
}

//===============referral Check==================

function checkRefCookie(){
make_c = 'Referral';
c_name=getCookie(make_c);
if (c_name!=null){}
else {
	
	var RefId = new Array;
		RefId[0] = '19021';
		RefId[1] = '19023';
		RefId[2] = '19025';
		RefId[3] = '19027';
		RefId[4] = '20021';
		RefId[5] = '20022';
		RefId[6] = '20023';
		RefId[7] = '20024';
		RefId[8] = '30021';
		RefId[9] = 'capterra';
		RefId[10] = '40022';
		RefId[11] = '40023';
		RefId[12] = '40024';
		RefId[13] = '50021';
		
	
		
	var RefName = new Array;
		RefName[0] = 'Dr. Friedman';
		RefName[1] = 'Dr. Hoffman';
		RefName[2] = 'Mr. Greenfield';
		RefName[3] = 'Dr. Gentempo';
		RefName[4] = 'DC Product Review';
		RefName[5] = 'ChiroEcon';
		RefName[6] = 'American Chiropractic';
		RefName[7] = 'ChiroMatrix';
		RefName[8] = 'Our eNewsletter';
		RefName[9] = 'c=35';
		RefName[10] = 'Google Ads';
		RefName[11] = 'The Power Zone';
		RefName[12] = 'ChiroCode';
		RefName[13] = 'TCA District Five';
	
		
	var RefS = "";
	var Reftest = "";
	var RefString = location.toString();
	if(RefString.indexOf("?")!= -1){
			var RefS = RefString.indexOf("?");
			var Reftest = RefString.substring(RefS+5);
			//document.write(Reftest);
			for (k=0;k<=RefId.length-1;k++){
				//document.write(Reftest==RefId[k]);
				if (Reftest==RefId[k]){
					setCookie(make_c,RefName[k],30);
					}
			}
	}}
}


		

//=======================================================
//Macromedia Scripts
//=======================================================

//Preload Images
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];}}
}

//Check for Plugins
function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

//-->
