

//portfolio javascripts
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function P7_autoShowHide() { //v1.2 by PVII-www.projectseven.com
 var g,b,k,f,ag=arguments,a=parseInt(ag[0]);
 if(!document.p7setc){p7c=new Array();document.p7setc=true;for(var u=0;u<10;u++){
 p7c[u]=new Array();}}for(k=0;k<p7c[a].length;k++){if((g=MM_findObj(p7c[a][k]))!=null){
 b=(document.layers)?g:g.style;b.display="none";}}for(k=1;k<ag.length;k++){
 if((g=MM_findObj(ag[k]))!=null){b=(document.layers)?g:g.style;b.display="block";
 f=false;for(var j=0;j<p7c[a].length;j++){if(ag[k]==p7c[a][j]){f=true;}}
 if(!f){p7c[a][p7c[a].length++]=ag[k];}}}
}
	
	
/////////////////
// open popup window for images
/////////////////

function openWindow(theURL,winName,myWidth,myHeight,isCenter) { //v3.0
  var features="";
  if(window.screen)if(isCenter)if(isCenter=="true"){
	var myLeft = (screen.width-myWidth)/2;
	var myTop = (screen.height-myHeight)/2;
	features+=(features!='')?',':'';
	features+=',scrollbars=no,resizable=no';
	features+=',left='+myLeft+',top='+myTop;
  }
  var winName = "Image";
  
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

// onclick="openWindow(this.href,'Case Study',500,300,'true'); return false;" 
// <a href="#" title="Click here for a Before and After presentation" onclick="openWindow('http://californiafineproperties.com/flash/cs1.php','Case Study',500,300,true);"></a>

// IE li:hover work around
startList = function() {
if (document.all&&document.getElementById) {
	navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
/*window.onload=startList;*/

/////////////////////
// CHECK FOR EXTERNAL LINKS
////////////////////
function externalLinks() {
        if (!document.getElementsByTagName) return;
        var anchors = document.getElementsByTagName("a");
        for (var i=0; i<anchors.length; i++) {
                var anchor = anchors[i];
                if (anchor.getAttribute("href") &&
                anchor.getAttribute("rel") == "external")
                anchor.target = "_blank";
        }
}
window.onload = startList, externalLinks;