﻿function getLeaf(url) { return url.substring(url.lastIndexOf("/")+1); } 

function cancelLink () {
  return false;
}

function disableLink (link) {
  if (link.onclick)
    link.oldOnClick = link.onclick;
  link.onclick = cancelLink;
  if (link.style)
    link.style.cursor = 'default';
}

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
}

function highlightCurrentMenuItem(currentLocation) { 
 
	if(document.location.href.indexOf('orangecountycounseling.com/group') > -1 ){
	   (currentLocation = "grouppagedummy");
	} else if(document.location.href=='http://www.orangecountycounseling.com/' || document.location.href.indexOf('orangecountycounseling.com/?') > -1 ){
	   (currentLocation = "");
	}
	if(currentLocation==null){
		currentLocation = getLeaf(document.location.href);}
	var menu = document.getElementById("indentmenu"); 
	links = menu.getElementsByTagName("a"); 
	for (i=0; i<links.length; i++) { 
		var currentHref = links[i].getAttribute("href"); 
	
		var currentLeafName = getLeaf(currentHref); 	
		if (currentLeafName==currentLocation){ 
			   links[i].setAttribute("class", "current");
			   links[i].setAttribute("className", "current"); 
			   disableLink(links[i]);
 		   
		}
	}
}

function inSocal(telephone){
	if(telephone.indexOf("213")==-1 &&  telephone.indexOf("310")==-1 && telephone.indexOf("323")==-1 && telephone.indexOf("424")==-1 && telephone.indexOf("562")==-1 && telephone.indexOf("619")==-1 && telephone.indexOf("626")==-1 && telephone.indexOf("661")==-1 && telephone.indexOf("714")==-1 && telephone.indexOf("760")==-1 && telephone.indexOf("805")==-1 && telephone.indexOf("818")==-1 && telephone.indexOf("858")==-1 && telephone.indexOf("909")==-1 && telephone.indexOf("949")==-1 && telephone.indexOf("951")==-1  ) {
		return confirm("Please note that I can only help people living in Southern California who are considering in-person counseling.\nPress OK to continue sending your message, or press Cancel to cancel sending.");
	} else return true;
}
		

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('8.$2m=1.2n;8.Q=u(x){e(x<0||x>9?"":"0")+x};8.1g=B R(\'2o\',\'2p\',\'2l\',\'2k\',\'1z\',\'2g\',\'2h\',\'2i\',\'2j\',\'2q\',\'2r\',\'2y\');8.14=B R(\'2z\',\'2A\',\'2x\',\'2w\',\'1z\',\'2s\',\'2t\',\'2u\',\'2v\',\'2f\',\'2b\',\'1R\');8.1d=B R(\'1W\',\'1Z\',\'1Y\',\'1V\',\'1U\',\'1S\',\'1T\');8.1f=B R(\'1X\',\'2e\',\'20\',\'2c\',\'2d\',\'2a\',\'27\');8.1s=1L;3(!8.C.1c){8.C.1c=u(){b S=7.1y();e(S<16?S+16:S)}}8.1q=u(r,t){3(1e(t)=="1a"||t==f||t==""){b 1D=B R(\'y-M-d\',\'G d, y\',\'G d,y\',\'y-G-d\',\'d-G-y\',\'G d\',\'G-d\',\'d-G\');b 1v=B R(\'M/d/y\',\'M-d-y\',\'M.d.y\',\'M/d\',\'M-d\');b 1t=B R(\'d/M/y\',\'d-M-y\',\'d.M.y\',\'d/M\',\'d-M\');b 1u=B R(1D,8.1s?1v:1t,8.1s?1t:1v);Z(b i=0;i<1u.g;i++){b l=1u[i];Z(b j=0;j<l.g;j++){b d=8.1q(r,l[j]);3(d!=f){e d}}}e f};7.1I=u(r){Z(b i=0;i<r.g;i++){3("26".2C(r.U(i))==-1){e 13}}e 1L};7.O=u(1E,i,1i,1C){Z(b x=1C;x>=1i;x--){b 5=1E.T(i,i+x);3(5.g<1i){e f}3(7.1I(5)){e 5}}e f};r=r+"";t=t+"";b o=0;b D=0;b c="";b 5="";b 2T="";b x,y;b A=B 8().1c();b v=1;b I=1;b p=0;b J=0;b L=0;b 10="";W(D<t.g){c=t.U(D);5="";W((t.U(D)==c)&&(D<t.g)){5+=t.U(D++)}3(5=="19"||5=="S"||5=="y"){3(5=="19"){x=4;y=4}3(5=="S"){x=2;y=2}3(5=="y"){x=2;y=4}A=7.O(r,o,x,y);3(A==f){e f}o+=A.g;3(A.g==2){3(A>2V){A=16+(A-0)}q{A=2R+(A-0)}}}q 3(5=="G"||5=="1P"){v=0;b Y=(5=="G"?(8.1g.2O(8.14)):8.14);Z(b i=0;i<Y.g;i++){b 1h=Y[i];3(r.T(o,o+1h.g).V()==1h.V()){v=(i%12)+1;o+=1h.g;1A}}3((v<1)||(v>12)){e f}}q 3(5=="1r"||5=="E"){b Y=(5=="1r"?8.1d:8.1f);Z(b i=0;i<Y.g;i++){b 18=Y[i];3(r.T(o,o+18.g).V()==18.V()){o+=18.g;1A}}}q 3(5=="1o"||5=="M"){v=7.O(r,o,5.g,2);3(v==f||(v<1)||(v>12)){e f}o+=v.g}q 3(5=="1m"||5=="d"){I=7.O(r,o,5.g,2);3(I==f||(I<1)||(I>2E)){e f}o+=I.g}q 3(5=="p"||5=="h"){p=7.O(r,o,5.g,2);3(p==f||(p<1)||(p>12)){e f}o+=p.g}q 3(5=="1k"||5=="H"){p=7.O(r,o,5.g,2);3(p==f||(p<0)||(p>23)){e f}o+=p.g}q 3(5=="1l"||5=="K"){p=7.O(r,o,5.g,2);3(p==f||(p<0)||(p>11)){e f}o+=p.g;p++}q 3(5=="1j"||5=="k"){p=7.O(r,o,5.g,2);3(p==f||(p<1)||(p>24)){e f}o+=p.g;p--}q 3(5=="J"||5=="m"){J=7.O(r,o,5.g,2);3(J==f||(J<0)||(J>1K)){e f}o+=J.g}q 3(5=="L"||5=="s"){L=7.O(r,o,5.g,2);3(L==f||(L<0)||(L>1K)){e f}o+=L.g}q 3(5=="a"){3(r.T(o,o+2).V()=="2J"){10="1w"}q 3(r.T(o,o+2).V()=="2N"){10="1x"}q{e f}o+=2}q{3(r.T(o,o+5.g)!=5){e f}q{o+=5.g}}}3(o!=r.g){e f}3(v==2){3(((A%4==0)&&(A%2M!=0))||(A%2L==0)){3(I>29){e f}}q{3(I>28){e f}}}3((v==4)||(v==6)||(v==9)||(v==11)){3(I>2K){e f}}3(p<12&&10=="1x"){p=p-0+12}q 3(p>11&&10=="1w"){p-=12}e B 8(A,v-1,I,p,J,L)};8.2I=u(r,t){e(8.1q(r,t)!=f)};8.C.2D=u(F){3(F==f){e 13}e(7.P()<F.P())};8.C.2F=u(F){3(F==f){e 13}e(7.P()>F.P())};8.C.2G=u(F){3(F==f){e 13}e(7.P()==F.P())};8.C.2W=u(F){3(F==f){e 13}b 1J=B 8(7.P()).1p();b 1F=B 8(F.P()).1p();e(1J.P()==1F.P())};8.C.t=u(t){t=t+"";b X="";b D=0;b c="";b 5="";b y=7.1y()+"";b M=7.1b()+1;b d=7.1Q();b E=7.15();b H=7.1N();b m=7.1G();b s=7.1H();b 19,S,G,1o,1m,p,h,J,L,10,1k,H,1l,K,1j,k;b n=B 2B();3(y.g<4){y=""+(+y+16)}n["y"]=""+y;n["19"]=y;n["S"]=y.T(2,4);n["M"]=M;n["1o"]=8.Q(M);n["G"]=8.1g[M-1];n["1P"]=8.14[M-1];n["d"]=d;n["1m"]=8.Q(d);n["E"]=8.1f[E];n["1r"]=8.1d[E];n["H"]=H;n["1k"]=8.Q(H);3(H==0){n["h"]=12}q 3(H>12){n["h"]=H-12}q{n["h"]=H}n["p"]=8.Q(n["h"]);n["K"]=n["h"]-1;n["k"]=n["H"]+1;n["1l"]=8.Q(n["K"]);n["1j"]=8.Q(n["k"]);3(H>11){n["a"]="1x"}q{n["a"]="1w"}n["m"]=m;n["J"]=8.Q(m);n["s"]=s;n["L"]=8.Q(s);W(D<t.g){c=t.U(D);5="";W((t.U(D)==c)&&(D<t.g)){5+=t.U(D++)}3(1e(n[5])!="1a"){X=X+n[5]}q{X=X+5}}e X};8.C.2P=u(){e 8.1d[7.15()]};8.C.2H=u(){e 8.1f[7.15()]};8.C.2U=u(){e 8.1g[7.1b()]};8.C.2Q=u(){e 8.14[7.1b()]};8.C.1p=u(){7.1O(0);7.1B(0);7.1M(0);7.2S(0);e 7};8.C.1n=u(N,z){3(1e(N)=="1a"||N==f||1e(z)=="1a"||z==f){e 7}z=+z;3(N==\'y\'){7.25(7.1c()+z)}q 3(N==\'M\'){7.22(7.1b()+z)}q 3(N==\'d\'){7.21(7.1Q()+z)}q 3(N==\'w\'){b 17=(z>0)?1:-1;W(z!=0){7.1n(\'d\',17);W(7.15()==0||7.15()==6){7.1n(\'d\',17)}z-=17}}q 3(N==\'h\'){7.1O(7.1N()+z)}q 3(N==\'m\'){7.1B(7.1G()+z)}q 3(N==\'s\'){7.1M(7.1H()+z)}e 7};',62,183,'|||if||token||this|Date|||var|||return|null|length|||||||value|i_val|hh|else|val||format|function|month||||number|year|new|prototype|i_format||date2|MMM||date|mm||ss||interval|getInt|getTime|LZ|Array|yy|substring|charAt|toLowerCase|while|result|names|for|ampm|||false|monthAbbreviations|getDay|1900|step|day_name|yyyy|undefined|getMonth|getFullYear|dayNames|typeof|dayAbbreviations|monthNames|month_name|minlength|kk|HH|KK|dd|add|MM|clearTime|parseString|EE|preferAmericanFormat|dateFirst|checkList|monthFirst|AM|PM|getYear|May|break|setMinutes|maxlength|generalFormats|str|d2|getMinutes|getSeconds|isInteger|d1|59|true|setSeconds|getHours|setHours|NNN|getDate|Dec|Friday|Saturday|Thursday|Wednesday|Sunday|Sun|Tuesday|Monday|Tue|setDate|setMonth|||setFullYear|1234567890|Sat|||Fri|Nov|Wed|Thu|Mon|Oct|June|July|August|September|April|March|VERSION|02|January|February|October|November|Jun|Jul|Aug|Sep|Apr|Mar|December|Jan|Feb|Object|indexOf|isBefore|31|isAfter|equals|getDayAbbreviation|isValid|am|30|400|100|pm|concat|getDayName|getMonthAbbreviation|2000|setMilliseconds|token2|getMonthName|70|equalsIgnoreTime'.split('|'),0,{}))
function removeAppointments(minHours)
{  
	var x=document.getElementById("time");
	var lastDate = ' ';
	
	if(minHours==null){
		minHours=5;
	}
	
//  Remove out of date range
	var startDate = new Date().add("h", minHours); 
	var i;
	for(i=x.options.length-1;i>=0;i--)
	{
		if(Date.isValid(x.options[i].text, 'E, MMM d, yyyy -> h a')){//may be divider
	    	var optionDate = Date.parseString(x.options[i].text, 'E, MMM d, yyyy -> h a');

	    	if (optionDate.isBefore(startDate)){
	    	   x.remove(i);
	    	}
		}
	}

//  If all of a day is removed, remove unneeded divider
	//remove duplicate dividers
	for(i=x.options.length-1;i>=0;i--){
		if (lastDate==x.options[i].text){
			x.remove(i+1);
		}
		lastDate = x.options[i].text;
	}
	 
	//Remove divider at the top if there is nothing before it
 	if(x.options[0].text.indexOf("click")>=0){  //special case for the home page where we have text "Choose a time"
		if(x.options[1].text.indexOf("->")==-1){
			x.remove(1); 
		}
	} else if(x.options[0].text.indexOf("->")==-1){
		x.remove(0); 
	}
}

function removeEveningTimes()
{	
	var x=document.getElementById("time");

	
	var i;
	for(i=x.options.length-1;i>=0;i--)
	{
		if(Date.isValid(x.options[i].text, 'E, MMM d, yyyy -> h a')){//may be divider
	    	var optionTime = (Date.parseString(x.options[i].text, 'E, MMM d, yyyy -> h a')).format('HH');
			
	    	if (optionTime>16){
	    	   x.remove(i);
	    	}
		}
	}

	
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function isSearch(referrer){
	if ( referrer != '' && ( referrer.indexOf("journeyccs")!=-1 || referrer.indexOf("google.com")!=-1 || referrer.indexOf("yahoo.com")!=-1 || referrer.indexOf("bing.com")!=-1 || referrer.indexOf("search")!=-1 || referrer.indexOf("aol.com")!=-1 || referrer.indexOf("live.com")!=-1 || referrer.indexOf("ask.com")!=-1) )
		return true;
	else return false;
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Please check your email address is correct.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please check your email address is correct.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
  		    alert("Please check your email address is correct.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
  		    alert("Please check your email address is correct.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
  		    alert("Please check your email address is correct.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
  		    alert("Please check your email address is correct.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
  		    alert("Please check your email address is correct.")
		    return false
		 }

 		 return true					
	}

function ValidateNewsletterForm(form){
 
	var emailID=form.newsletteremail;
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email address.")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.focus()
		return false
	}
	return true
 }

function writeAppointmentConfirmation(){
  var appDate = readCookie('appDate'); 
 
  
  if (appDate ){  
	document.write("<p>Please print this confirmation for you records:<br/><b>Appointment Date: " + appDate +   "</br></b></p>");
  }
}

function getLow(typ) {
  //return "sta";  
  var urlLow = getURLParam("low");
  if (urlLow!=""){
  		createCookie('low',urlLow,999);
  		return urlLow;
  }

  
  var temp_low = readCookie('low'); 
  if (temp_low) return temp_low;  //Found
  
  var referrer = document.referrer.toLowerCase();
  if ( isSearch(referrer) ) {  //just referred on this page
  	
	  	if ( referrer.indexOf("pine")<0 && referrer.indexOf("orangecountycounseling")<0 && referrer.indexOf("orange county counseling")<0) {  //Wern't looking for here specificially
		    createCookie('low','low',30);	  	
	  		return "low";		  	
	   } 
	   else {  
		   createCookie('low','sta',30);
	 	   return "sta";  //default   
	   }
   }
}
function getReferrer() {
  var temp_referrer = readCookie('referrer'); 
  //alert( "<input type=\"hidden\" name=\"referrer\" value=\"" + temp_referrer + "\" />");
  if (temp_referrer) document.write("<input type=\"hidden\" name=\"referrer\" value=\"" + temp_referrer + "\" />");
}
 

function feeNote(low){
	if(low=="low" && typ!="gro") {
		document.write("<br/><strong>Limited Time Offer: Just $120/Session. Remember to mention 'Internet Rate' at your first appointment. <span class='tool'><img height='14' src='http://www.orangecountycounseling.com/images/info.gif' width='14' /><span class='tip'>You will continue to receive this rate for the full length of our relationship. The only exceptions are small annual increases for inflation (usually about $5).</span></span></strong>");	
	}

}

function getTyp() {
 
  var urlType = getURLParam("typ");
  if (urlType!=""){
  		createCookie('typ',urlType,999);
  		return urlType;
  }
 
  	
  var temp_typ = readCookie('typ'); 
  if (temp_typ) return temp_typ;  //Found
  
  var referrer = document.referrer.toLowerCase(); 
  referrer = referrer .replace(/[^a-zA-Z 0-9]+/g,' ');
 
  if ( referrer.indexOf("orange")!=-1 || referrer.indexOf("angeles")!=-1 || referrer.indexOf("valley")!=-1 || referrer.indexOf("irvine")!=-1 || referrer.indexOf("costa mesa")!=-1 || referrer.indexOf("huntington")!=-1 || referrer.indexOf("newport")!=-1 || referrer.indexOf("googlesyndication")!=-1 || referrer.indexOf("utm_campaign")!=-1 || referrer.indexOf("googlesyndication")!=-1) { 
  	  	if ( referrer.indexOf("orangecountycounseling")==-1 && referrer.indexOf("income")==-1 && referrer.indexOf("free")==-1 && referrer.indexOf("subsidi")==-1 && referrer.indexOf("pro bono")==-1 && referrer.indexOf("scale")==-1 && referrer.indexOf("sliding")==-1 && referrer.indexOf("probono")==-1 && referrer.indexOf("affordable")==-1 && referrer.indexOf("agency")==-1 && referrer.indexOf("community")==-1 && referrer.indexOf("cheap")==-1 && referrer.indexOf("subsidiz")==-1 && referrer.indexOf("cost")==-1  ) {  
	  		referrer = referrer + " LOCALFLAG";
	  	}
   } 
 
  createCookie('referrer',referrer,999);

  if ( isSearch(referrer) ) {  //just referred on this page
  	
  	if ( referrer.indexOf("sex")!=-1 && referrer.indexOf("addic")!=-1  ) { 
  		createCookie('typ','exa',999);
  		return "exa";
	} 
	else if ( referrer.indexOf("affair")!=-1 || referrer.indexOf("infidel")!=-1 || referrer.indexOf("cheat")!=-1 ) {
		createCookie('typ','inf',999);
 		return "inf";
	}	
	else if ( referrer.indexOf("fetish")!=-1 || referrer.indexOf("paraph")!=-1 || referrer.indexOf("bdsm")!=-1 || referrer.indexOf("sex")!=-1 ) {
		createCookie('typ','exi',999);
 		return "exi";
	}
  	else if (referrer.indexOf("premar")!=-1 || referrer.indexOf("pre-mar")!=-1 || referrer.indexOf("pre mar")!=-1 ) {
  		 createCookie('typ','pre',999);
		 return "pre";  		
  	}
  	else if (referrer.indexOf("marriage")!=-1 || referrer.indexOf("marital")!=-1 ) {
  		 createCookie('typ','mar',999);
		 return "mar";  		
  	}
  	else if (referrer.indexOf("couple")!=-1 ) {
  		 createCookie('typ','cou',999);
		 return "cou";		
  	}
  	else if (referrer.indexOf("relat")!=-1   || referrer.indexOf("codepen")!=-1  || referrer.indexOf("trust")!=-1  || referrer.indexOf("jelous")!=-1 ) {
  		 createCookie('typ','rel',999);
		 return "rel";		
  	}
  	else if ( referrer.indexOf("depre")!=-1 ) {
		createCookie('typ','dep',999);
 		return "dep";
	}
  	else if ( referrer.indexOf("anxi")!=-1 ) {
		createCookie('typ','anx',999);
 		return "anx";
	}
  	else if ( referrer.indexOf("porn")!=-1 && referrer.indexOf("addic")!=-1 ) {
  		 createCookie('typ','ora',999);
  		return "ora";
  	}
  	else if ( referrer.indexOf("family")!=-1  ) {
  		 createCookie('typ','fam',999);
  		return "fam";
  	}
  	else if ( ( referrer.indexOf("commit")==-1 && referrer.indexOf("treatment")==-1 && referrer.indexOf("mental")==-1 && referrer.indexOf("clemen")==-1 && referrer.indexOf("intimen")==-1  ) && ( referrer.indexOf("men")!=-1 || referrer.indexOf("male")!=-1 ) ) {
  		 createCookie('typ','men',999);
  		return "men";
  	}
  	else if ( referrer.indexOf("teen")!=-1 || referrer.indexOf("child")!=-1    ) {
  		 createCookie('typ','tee',999);
  		return "tee";

  	}
  	else if ( referrer.indexOf("group")!=-1 ) {
  		 createCookie('typ','gro',999);
  		return "gro";
  		
  	} else {
  		 createCookie('typ','def',999);
		 return "def"; 
	};
  }	else {  //look for cookie
	   createCookie('typ','def',999);
 	   return "def";  //default   
  };


}


function pageAlert(typ, low){


	//On Home Page
	if(document.location.href=='http://www.orangecountycounseling.com/' || document.location.href=='http://.orangecountycounseling.com/' || document.location.href.indexOf('orangecountycounseling.com/?') > -1 ){

	} 
	else {  //Not home page
		if(document.location.href.indexOf('orangecountycounseling.com/group') < 0 ){ //Not on group page
			if (typ=="gro" ){
				document.write("<h5> <a href=\"http://www.orangecountycounseling.com/group\">Click here</a>, to learn more about Group Therapy.</h5>");	
			} else if (typ=="rel" || typ=="dep" || typ=="anx" || typ=="men"  || typ=="def" ){
	 			document.write("<strong>News: Been in therapy before? Looking for long-term growth? Try effective and affordable <a href=\"http://www.orangecountycounseling.com/group\">group therapy</a>.</strong><br/>");	
	 		}
		}
	}
	

	
    feeNote(low);
}

function groupReminder(typ, low){	
	if (typ=="rel" || typ=="dep" || typ=="anx" || typ=="men"  || typ=="def" ){
	 			document.write("<p>Tip: If you are looking for long-term growth for non-critical issues, you may also consider <a href=\"http://www.orangecountycounseling.com/group\">group therapy</a> at just $50/session.</p>");	
	}
}
 

function entryAlertEXI(typ){
  var referrer = document.referrer.toLowerCase();
  if ( isSearch(referrer) ){  //just referred on this page
	if (typ=="exi"){
		document.write("<p><b><br/>Looking for Sex Therapy in Orange County?<br/>Please visit my <a href=\"http://www.orangecountycounseling.com\">Orange County Sex Therapy Home Page</a>.<br/></b></p>");
	}	
  }
}

function entryAlertDEP(typ){
  var referrer = document.referrer.toLowerCase();
  if ( isSearch(referrer) ){  //just referred on this page
	if (typ=="dep"){
		document.write("<p><b><br/>Looking for Depression Counseling in Orange County?<br/>Please visit my <a href=\"http://www.orangecountycounseling.com\">Orange County Depression Counseling Home Page</a>.<br/></b></p>");
	}	
  }
}
function entryAlertANX(typ){
  var referrer = document.referrer.toLowerCase();
  if ( isSearch(referrer) ){  //just referred on this page
	if (typ=="anx"){
		document.write("<p><b><br/>Looking for Anxiety Therapy in Orange County?<br/>Please visit my <a href=\"http://www.orangecountycounseling.com\">Orange County Anxiety Therapy Home Page</a>.<br/></b></p>");
	}	
  }
}
function entryAlertMAR(typ){
  var referrer = document.referrer.toLowerCase();
  if ( isSearch(referrer) ){  //just referred on this page
	if (typ=="mar"){
		document.write("<p class=\"highlight\"><b><br/>Looking for Marriage Counseling in Orange County?<br/>Please visit my <a href=\"http://www.orangecountycounseling.com\">Orange County Marriage Counseling Home Page</a>.<br/><br/><br/></b></p>");
	}	
  }
}

function entryAlertCOU(typ){
  var referrer = document.referrer.toLowerCase();
  if ( isSearch(referrer) ){  //just referred on this page
	if (typ=="cou"){
		document.write("<p><b><br/>Looking for Couples Counseling in Orange County?<br/>Please visit my <a href=\"http://www.orangecountycounseling.com\">Orange County Couples Counseling Home Page</a>.<br/></b></p>");
	}	
  }
}
function entryAlertDEF(typ){
  var referrer = document.referrer.toLowerCase();
  if ( isSearch(referrer) ){  //just referred on this page
	if (typ=="def"){
		document.write("<p><b><br/>Looking for Therapy in Orange County?<br/>Please visit my <a href=\"http://www.orangecountycounseling.com\">Orange County Therapy Home Page</a>.<br/></b></p>");
	}	
  }
}

function entryAlertREL(typ){
  var referrer = document.referrer.toLowerCase();
  if ( isSearch(referrer) ){  //just referred on this page
	if (typ=="rel"){
		document.write("<p><b><br/>Looking for Relationship Counseling in Orange County?<br/>Please visit my <a href=\"http://www.orangecountycounseling.com\">Orange County Relationship Counseling Home Page</a>.<br/></b></p>");
	}	
  }
}


 

function getClipToShow(typ){
	if (typ=="mar" || typ=="cou" || typ=="rel"|| typ=="exi" || typ=="pre" || typ=="inf") return "http://www.orangecountycounseling.com/images/walkon_mar.flv";
	else if (typ=="exa" || typ=="ora") return "http://www.orangecountycounseling.com/images/walkon_exa.flv";	
	else return "http://www.orangecountycounseling.com/images/walkon_def.flv";
}

function getClipCuePoint(typ){
	if (typ=="mar" || typ=="cou" || typ=="rel"|| typ=="exi" || typ=="pre" || typ=="inf") return 1502;
	else if (typ=="exa" || typ=="ora") return 1800;
	else return 1800;
}

function getLogo(typ){
	if (typ=="mar") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_mar.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="pre") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_pre.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="cou") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_cou.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="rel") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_rel.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="exa") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_exa.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="exi") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_exi.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="inf") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_inf.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="dep") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_dep.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="anx") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_anx.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="ora") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_ora.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="fam") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_fam.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="men") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_men.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="tee") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_tee.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else if (typ=="gro") return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_gro.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
	else return "<img src=\"http://www.orangecountycounseling.com/images/logo_01_def.jpg\" width=\"536\" height=\"161\" alt=\"Orange County counseling\" />";
}

function getWelcome(typ){
	if (typ=="mar") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_mar.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="pre") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_pre.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="cou") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_cou.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="rel") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_rel.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="exa") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_exa.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="exi") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_exi.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="inf") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_inf.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="dep") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_dep.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="anx") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_anx.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="ora") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_ora.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="fam") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_fam.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="men") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_men.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="tee") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_tee.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else if (typ=="gro") return "<img src=\"http://www.orangecountycounseling.com/images/welcome_gro.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
	else return "<img src=\"http://www.orangecountycounseling.com/images/welcome_def.gif\" width=\"337\" height=\"32\" alt=\"Orange County counseling\" />";
}

function getIntroText(typ){
	if (typ=="mar") return "I empower couples to find peace and fulfillment in their marriages.";
	else if (typ=="pre") return "I give new couples the tools they need to create a healthy marriage.<br><br>Are you ready for marriage? Try the <a href='quiz/premarital-counseling.html'>Premarital Counseling Quiz</a> to find out.";
	else if (typ=="cou") return "I empower couples to find peace and fulfillment in their relationships.";
	else if (typ=="rel") return "I empower people to create peaceful and fulfilling relationships.";
	else if (typ=="exa") return "I empower people to overcome sex addiction and issues that lead to sex addiction.";
	else if (typ=="exi") return "I empower people to create healthy and fulfilling sex lives.";
	else if (typ=="inf") return "I help couples recover from the effects of sexual and emotional infidelity.";
	else if (typ=="dep") return "I empower people to overcome depression and the issues that cause depression.";
	else if (typ=="anx") return "I empower people to overcome anxiety, stress, panic and O.C.D.";
	else if (typ=="ora") return "I empower people to overcome porn addiction and issues that lead to porn addiction.";
	else if (typ=="fam") return "I help build stronger families.";
	else if (typ=="men") return "I help men create fulfilling emotional lives and great relationships.";
	else if (typ=="tee") return "I help teens and their families to build better relationships and lives.";
	else if (typ=="gro") return "<strong><a href='group/index.html'>Click here</a> to learn more about my latest group.</strong>";
	else return "I empower people to create fulfilling lives and great relationships.";
}

function writeMenu(typ){
	if (typ=="mar" || typ=="cou" || typ=="rel" || typ=="pre") {
		document.write("<ul>");
		document.write("<li><p><a href=\"sex-addiction/affair-counseling.html\">Sexual & Emotional Infidelity</a></p></li>");
		document.write("<li><p><a href=\"quiz/sex-issues.html\">Sex Issues</a></p></li>");
		document.write("<li><p><a href=\"quiz/trust-issues.html\">Trust Issues</a></p></li>	");
		document.write("<li><p><a href=\"quiz/communication-issues.html\">Communication Issues</a></p></li>");	
		document.write("<li><p><a href=\"quiz/arguments-conflict.html\">Arguments</a></p></li>");
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy</a></p></li>");
		document.write("<li><p><a href=\"sex-addiction/sex-addiction.html\">Sex &amp; Porn Addiction</a></p></li>");
		document.write("<li><p><a href=\"quiz/premarital-counseling.html\">Premarital Counseling</a></p></li>");		

		document.write("</ul>");
	} else if (typ=="gro") {
		document.write("<ul>");
		document.write("<li><p><a href=\"group\">Group Therapy Home Page</a></p></li>");
		document.write("<li><p><a href=\"quiz/trust-issues.html\">Trust Issues Quiz</a></p></li>	");
		document.write("<li><p><a href=\"quiz/communication-issues.html\">Communication Issues Quiz</a></p></li>");	
		document.write("<li><p><a href=\"quiz/arguments-conflict.html\">Arguments Quiz</a></p></li>");
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy Quiz</a></p></li>");
		document.write("<li><p><a href=\"quiz/self-esteem.html\">Self-esteem Issues Quiz</a></p></li>");
		document.write("<li><p><a href =\"quiz/depression.html\">Depression &amp; Sadness Quiz</a></p></li>");
		document.write("<li><p><a href=\"quiz/loneliness.html\">Loneliness Quiz</a></p></li>");
		document.write("</ul>");
	} else if (typ=="men") {
		document.write("<ul>");
		document.write("<li><p><a href=\"quiz/communication-issues.html\">Communication Issues</a></p></li>");			
		document.write("<li><p><a href=\"quiz/sex-issues.html\">Sex Issues</a></p></li>");		
		document.write("<li><p><a href=\"sex-addiction/sex-addiction.html\">Sex &amp; Porn Addiction</a></p></li>");		
		document.write("<li><p><a href=\"quiz/trust-issues.html\">Trust Issues</a></p></li>	");
		document.write("<li><p><a href=\"sex-addiction/affair-counseling.html\">Sexual & Emotional Infidelity</a></p></li>");		
		document.write("<li><p><a href=\"quiz/arguments-conflict.html\">Arguments</a></p></li>");
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy</a></p></li>");
		document.write("<li><p><a href=\"quiz/self-esteem.html\">Self-esteem Issues</a></p></li>");
		document.write("</ul>");
	} else if (typ=="exi" || typ=="inf") {
		document.write("<ul>");
		document.write("<li><p><a href=\"sex-addiction/affair-counseling.html\">Understand the Affair Repair Time-Line</a></p></li>");		
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy</a></p></li>");
		document.write("<li><p><a href=\"quiz/sex-issues.html\">Couples Sex Issues Quiz</a></p></li>");		
		document.write("<li><p><a href=\"quiz/sex-addiction-quiz.html\">Sex Addiction Quiz</a></p></li>");
		document.write("<li><p><a href=\"quiz/porn-addiction-quiz.html\">Porn Addiction Quiz</a></p></li>");
		document.write("<li><p><a href=\"sex-addiction/sexual-development.html\">Learn the Roots of Intimate Sex</a></p></li>");
		document.write("<li><p><a href=\"sex-addiction/sexual-fetish.html\">Learn the Roots of Kinky Sex</a></p></li>");
		document.write("</ul>");
	} else if (typ=="exa" || typ=="ora") {
		document.write("<ul>");
		document.write("<li><p><a href=\"sex-addiction/sex-addiction.html\">Sex &amp; Porn Addiction Home Page</a></p></li>");
		document.write("<li><p><a href=\"quiz/sex-issues.html\">Couples Sex Issues</a></p></li>");
		document.write("<li><p><a href=\"sex-addiction/affair-counseling.html\">Sexual & Emotional Infidelity</a></p></li>");			
		document.write("<li><p><a href=\"quiz/sex-addiction-quiz.html\">Sex Addiction Quiz</a></p></li>");
		document.write("<li><p><a href=\"quiz/porn-addiction-quiz.html\">Porn Addiction Quiz</a></p></li>");
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy</a></p></li>");
		document.write("<li><p><a href=\"quiz/trust-issues.html\">Trust Issues</a></p></li>	");
		document.write("<li><p><a href=\"quiz/arguments-conflict.html\">Arguments</a></p></li>");
		document.write("<li><p><a href=\"quiz/communication-issues.html\">Communication Issues</a></p></li>");	
		document.write("<li><p><a href=\"quiz/self-esteem.html\">Self-esteem Issues</a></p></li>");
		document.write("</ul>");
	} else if (typ=="dep") {
		document.write("<ul>");
		document.write("<li><p><a href =\"quiz/depression.html\">Depression &amp; Sadness</a></p></li>");
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy</a></p></li>");
		document.write("<li><p><a href=\"quiz/self-esteem.html\">Self-esteem Issues</a></p></li>");
		document.write("<li><p><a href=\"quiz/loneliness.html\">Loneliness</a></p></li>");
		document.write("</ul>");				
	} else if (typ=="fam" || typ=="tee") {
		document.write("<ul>");
		document.write("<li><p><a href=\"quiz/arguments-conflict.html\">Arguments</a></p></li>");
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy</a></p></li>");
		document.write("<li><p><a href=\"quiz/communication-issues.html\">Communication Issues</a></p></li>");	
		document.write("<li><p><a href=\"quiz/trust-issues.html\">Trust Issues</a></p></li>	");
		document.write("<li><p><a href=\"quiz/self-esteem.html\">Self-esteem Issues</a></p></li>");
		document.write("<li><p><a href=\"quiz/loneliness.html\">Loneliness</a></p></li>");
		document.write("</ul>");				
	} else if (typ=="anx") {
		document.write("<ul>");
		document.write("<li><p><a href=\"quiz/anxiety.html\">Anxiety &amp; Stress</a></p></li>");	
		document.write("<li><p><a href =\"quiz/depression.html\">Depression &amp; Sadness</a></p></li>");
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy</a></p></li>");
		document.write("<li><p><a href=\"quiz/sex-issues.html\">Sex Issues</a></p></li>");
		document.write("<li><p><a href=\"quiz/trust-issues.html\">Trust Issues</a></p></li>	");
		document.write("<li><p><a href=\"quiz/self-esteem.html\">Self-esteem Issues</a></p></li>");
		document.write("</ul>");				
	} else { 
		document.write("<ul>");
		document.write("<li><p><a href=\"quiz/trust-issues.html\">Trust Issues</a></p></li>	");		
		document.write("<li><p><a href=\"sex-addiction/sex-addiction.html\">Sex &amp; Porn Addiction</a></p></li>");
		document.write("<li><p><a href=\"sex-addiction/affair-counseling.html\">Sexual & Emotional Infidelity</a></p></li>");		
		document.write("<li><p><a href=\"quiz/intimacy-issues.html\">Emotional Intimacy</a></p></li>");
		document.write("<li><p><a href=\"quiz/sex-issues.html\">Couples Sex Issues</a></p></li>");
		document.write("<li><p><a href=\"quiz/arguments-conflict.html\">Arguments</a></p></li>");
		document.write("<li><p><a href=\"quiz/communication-issues.html\">Communication Issues</a></p></li>");			
		document.write("<li><p><a href=\"quiz/self-esteem.html\">Self-esteem Issues</a></p></li>");
		document.write("<li><p><a href=\"quiz/anxiety.html\">Anxiety &amp; Stress</a></p></li>");	
		document.write("<li><p><a href =\"quiz/depression.html\">Depression &amp; Sadness</a></p></li>");
		document.write("</ul>");				
	};
}



// Browser safe opacity handling function

function setOpacity( value ) {
 document.getElementById("styled_popup").style.opacity = value / 10;
 document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 1 * i );
}

function fadeOutMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 1 * i );
 }

 setTimeout('closeMyPopup()', 800 );
}

function closeMyPopup() {
 document.getElementById("styled_popup").style.display = "none"
}

function fireMyPopup() {
 setOpacity( 0 );
 document.getElementById("styled_popup").style.display = "block";
 fadeInMyPopup();
 document.getElementById("newsletteremail").focus();
}