function mainmenuover(what) {}
function mainmenuout(what) {}




/********** tell a friend *************/
window.form_friend_options = {
	duration:		700,
	transition:		Fx.Transitions.Cubic.easeOut,
	transition_types:	['morph', 'fade'], // morph, fade
	overlay:		{ color: '#000000', opacity: 0.5, close_on_click: false }
};


/********** optin *************/
window.form_subscribe_options = {
	duration:		700,
	transition:		Fx.Transitions.Cubic.easeOut,
	transition_types:	['morph', 'fade'], // morph, fade
	overlay:		{ color: '#000000', opacity: 0.5, close_on_click: true }
};

/******** gallery **********/
window.gallery_options = {
	overlay: 	{ color: '#000000', opacity: 0.5, close_on_click: false },
	background: 	'#ffffff',
	fontcolor:	'#000000',
	border:		'solid gray 1px',
	padding:	'10px',
	image_dir:	'gallery-light',
	fade_duration:	500,
	morph_duration:	400,
	enable_slideshow: true,
	slideshow_delay: 7000
};




function doOnLoad() {

	// preload images


}

function preload(imgsrc) {
	var i = new Image();
	i.src = imgsrc;
}



// error class
function Errors() {
	this.errors = new Array();

	this.add = function(msg) {
		this.errors[this.errors.length] = msg;
	}
	this.alert = function() {
		if(!this.errors.length) return false;

		var msg = 'The following error(s) have occurred:\n\n';

		for(var i=0; i<this.errors.length; ++i) {
			msg += '*  ' + this.errors[i];
			if(i < this.errors.length - 1) msg += '\n\n';
		}

		alert(msg);
		return true;
	}
}

function validate_email(email) {
	if(email.length <= 5) return false;
	if(email.indexOf('@', 0) == -1) return false;
	return true;
}



//Browser detect
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

if (version <5 && browser == "Netscape Navigator") {
	document.write('<p><b><font size="4">Sorry, but this web site requires version 6 and above of Netscape or version 5 and above of Internet Explorer.</b></p>');
}

//style
document.write('<style type="text/css">');
if (browser != "Netscape Navigator" && browser != "Safari") {
	document.write('#scrollContent { position: absolute; width: 405px; z-index: 1; left: 0px; top: 0px; border: 0px none #000000}');
	document.write('#scrollContainer { position:relative; width:410px; height:358px; background-color:#ffffff; layer-background-color:#ffffff; z-index:3; left: 0px; top: 0px; overflow: hidden; border: 1px none #ffffff; clip: rect(0px 410px 358px 0px }');
	document.write('#divContainer {	VISIBILITY: hidden; OVERFLOW: hidden; WIDTH:410px; CLIP: rect(0px 410px 358px 0px); POSITION: relative; HEIGHT: 358px; TOP: 0px; LEFT: 0px; }');
	document.write('.content { text-align:justify; width:95%; background:white; padding:8px; border:1px dashed #CCCCCC; margin:auto;}');
} else {
	document.write('#scrollContent { position: relative; width: 405px; z-index: 1; left: 0px; top: 0px; border: 0px none #000000}');
	document.write('#scrollContainer { position:relative; width:410px; height:358px; background-color:#ffffff; layer-background-color:#ffffff; z-index:3; left: 0px; top: 0px; overflow: hidden; border: 1px none #ffffff; clip: rect(0px 410px 358px 0px}');
	document.write('.content { text-align:justify; width:92%; background:white; padding:8px; border:1px dashed #CCCCCC; margin:auto;}');
}
document.write('</style>');

highlightcolour="#ffffff";
highlightbackground="#ffffff";
highlighttext='-';
normalcolour="#ffffff";
normalbackground="#ffffff";
normaltext='+';


// open window
function newwin(page,name,attributes) {
	window.open(page,name,attributes);
}
// open window and write to it
function popWrite(title,height,width,content) {

	move_x=screen.availWidth/2 - width/2;
	move_y=screen.availHeight/2 - height/2;
	
	printWindow=window.open("","_","height=" + height + ",width=" + width +",top=" + move_y + ",left=" + move_x + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,history=no")
	printWindow.document.open()
	printWindow.document.write('<HTML><HEAD><TITLE>' + title + '</TITLE>\n')
	printWindow.document.write('<link rel="stylesheet" href="http://www.camaleo.com/assets/css/gen.css" type="text/css"></HEAD><BODY bgcolor="#ffffff">\n')
	printWindow.document.write(content + '\n')
	printWindow.document.write ("<br><div align=\"center\"><input type=\"button\" name=\"Close\" value=\"Close\" onclick=\"self.close();\" class=\"button\"></div></body></html>\n")
	printWindow.document.close()

}
//function to validate by length
function validlength(item, len) {
   return (item.length >= len);
}
//function to validate an email address
function validemail(item) {
   if (!validlength(item, 5)) return false;
   if (item.indexOf ('@', 0) == -1) return false;
   return true;
}
// display an error alert
function error(elem, text) {
// abort if we already found an error
   if (errfound) return;
   window.alert(text);
   elem.select();
   elem.focus();
   errfound = true;
}
// main validation function
function validate_optin() {
   errfound = false;
			if (!validemail(document.optin.email.value))
    			error(document.optin.email,"Sorry, Invalid Email Address!");

   return !errfound; /* true if there are no errors */
}

function validate_optin2() {
   errfound = false;
			if (!validemail(document.optin2.email.value))
    			error(document.optin2.email,"Sorry, Invalid Email Address!");

   return !errfound; /* true if there are no errors */
}

//Date
var time = new Date(), year;
year = time.getFullYear();

//erase imput box content
var effaced=0;
function efface (elem) {
	if (effaced == 1){
		elem.value='';
	}
	effaced=effaced+1;
}

//Navigation

//rollovers
if (document.images) {
	pic1 = new Image
	pic1.src = "http://www.camaleo.com/assets/pics/btn_company_a.gif"
	pic2 = new Image
	pic2.src = "http://www.camaleo.com/assets/pics/btn_expertise_a.gif"
	pic3 = new Image
	pic3.src = "http://www.camaleo.com/assets/pics/btn_webtools_a.gif"
	pic4 = new Image
	pic4.src = "http://www.camaleo.com/assets/pics/btn_case_studies_a.gif"
	pic4 = new Image
	pic4.src = "http://www.camaleo.com/assets/pics/btn_wine_a.gif"

} 

function turn_on (img,self) {
	if (document.images)  {
		document.images[img].src='http://www.camaleo.com/assets/pics/btn_' + img + '_a.gif';
	}
}

function turn_off (img,self) {
	if (active_btn != self) {
		if (document.images) {
			document.images[img].src='http://www.camaleo.com/assets/pics/btn_' + img + '.gif';
		}
	}
}


function write_navig (active) {
	active_btn = active;
	if (active_btn == "company") {status="_a";} else {status="";}
	document.write ( "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td><a href=\"http://www.camaleo.com/company.html\" onMouseOver=\"turn_on('company','company'); turn_off ('" + active_btn + "','company')\" onMouseOut=\"turn_off('company','company'); turn_on('" + active_btn + "','company');\"><img name=\"company\" src=\"http://www.camaleo.com/assets/pics/btn_company" + status + ".gif\" alt=\"company\" width=\"60\" height=\"16\" border=\"0\"></a><img src=\"http://www.camaleo.com/pics/d_clear.gif\" width=\"10\" height=\"1\" border=\"0\">");

	if (active_btn == "expertise") {status="_a";} else {status="";}
	document.write ( "<a href=\"http://www.camaleo.com/expertise.html\" onMouseOver=\"turn_on('expertise','expertise'); turn_off ('" + active_btn + "','expertise')\" onMouseOut=\"turn_off('expertise','expertise'); turn_on('" + active_btn + "','expertise');\"><img name=\"expertise\" src=\"http://www.camaleo.com/assets/pics/btn_expertise" + status + ".gif\" alt=\"expertise\" width=\"60\" height=\"16\" border=\"0\"></a><img src=\"http://www.camaleo.com/pics/d_clear.gif\" width=\"10\" height=\"1\" border=\"0\">");

	if (active_btn == "webtools") {status="_a";} else {status="";}
	document.write ( "<a href=\"http://www.camaleo.com/webtools.html\" onMouseOver=\"turn_on('webtools','webtools'); turn_off ('" + active_btn + "','webtools')\" onMouseOut=\"turn_off('webtools','webtools'); turn_on('" + active_btn + "','webtools');\"><img name=\"webtools\" src=\"http://www.camaleo.com/assets/pics/btn_webtools" + status + ".gif\" alt=\"webtools\" width=\"61\" height=\"16\" border=\"0\"></a><img src=\"http://www.camaleo.com/pics/d_clear.gif\" width=\"10\" height=\"1\" border=\"0\">");

	if (active_btn == "portfolio") {status="_a";} else {status="";}
	document.write ( "<a href=\"http://www.camaleo.com/portfolio.html\" onMouseOver=\"turn_on('portfolio','portfolio'); turn_off ('" + active_btn + "','portfolio')\" onMouseOut=\"turn_off('portfolio','portfolio'); turn_on('" + active_btn + "','portfolio');\"><img name=\"portfolio\" src=\"http://www.camaleo.com/assets/pics/btn_portfolio" + status + ".gif\" alt=\"case studies\" width=\"59\" height=\"16\" border=\"0\"></a></td>");
	
	if (active_btn == "wine") {status="_a";} else {status="";}
	document.write ( "<td align=\"right\"><a href=\"http://www.camaleo.com/wine.html\" onMouseOver=\"turn_on('wine','wine'); turn_off ('" + active_btn + "','wine')\" onMouseOut=\"turn_off('wine','wine'); turn_on('" + active_btn + "','wine');\"><img name=\"wine\" src=\"http://www.camaleo.com/assets/pics/btn_wine" + status + ".gif\" alt=\"CAMALEO and the wine industry\" width=\"219\" height=\"16\" border=\"0\"></a></td></tr></table>");

}
//Footer
function print_footer () {

	var URL = unescape(location.href)
	var start = URL.lastIndexOf("/") + 1
	var end = URL.length
	var docName = URL.substring(start,end)
	var subnavig = "";
	
	var docSection = new Array(
		"news.html",
		"clientweb.html",
		"employment.html",
		"contact.html",
		"privacy.html"
	);
	var nameSection = new Array(
		"news",
		"clientweb",
		"employment",
		"contact",
		"privacy"
	);

	for (var i=0; i<docSection.length; i++) {
		if (docName == docSection[i]) {
			color="C1C1C1";
		} else {
			color="349FA2";
		}
		if (i!=4) {
			spacing = "&nbsp; &nbsp;&nbsp;";
		} else {
			spacing = "";
		}
		subnavig = subnavig + '<a href="http://www.camaleo.com/' + docSection[i] + '"><font color="' + color + '">' + nameSection[i] + '</font></a>' + spacing;
	}
	document.write ('<form class="tb" name="optin" action="http://www.camaleo.com/cgi-bin/cdb/cdb_form.cgi" method="POST" onsubmit="return validate_optin();"><table width="730" border="0" cellspacing="0" cellpadding="0"><tr><td class="smallest" valign="top" height="20">Copyright &copy; 2000-');
	document.write (year);
	document.write (' <a href="http://www.camaleo.com">CAMALEO</a> LLC&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;707-265-6327 or <a href="mailto:info@camaleo.com">info@camaleo.com</a></td>');
	document.write ('<td align="right" class="navig" valign="top">' + subnavig + '</td></tr>');
	document.write ('<tr><td><input type="button" name="tell-a-friend" class="button" style="font-size:10px;" value="tell-a-friend" onclick="newwin(\'http://www.camaleo.com/cgi-bin/cdb/cdb_tellafriend.cgi?url=\' + document.location.href + \'&title=\' + document.title + \'&\',\'TellAFriend\',\'height=300,width=640,left=\' + [screen.availWidth/2-640/2] + \',top=\' + [screen.availHeight/2-300/2] + \',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,history=no\');"></td><td align="right">');
	document.write ('<div class="smallest">eNewsletter signup: ');
	document.write ('<input type="hidden" name="db_name" value="optin">');
	document.write ('<input type="hidden" name="emailing" value="yesemailing">');
	document.write ('<input style="font-size:10px;"  type="TEXT" name="email" size="14" value="Your email here!" onFocus="efface(document.optin.email);" onclick="efface(document.optin.email);" align="middle">&nbsp;<input type="submit" name="Submit" class="button" style="font-size:10px;" value="Submit" align="middle"></div></td></tr>');
	document.write ('</td></tr></table></form>');
}
// scrollable area
function objFind(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=objFind(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function scrollNow(el, x, y, a, b, c, s) { //v2.8 PVII
 var g,elo=el,f="",m=false,d="";x=parseInt(x);y=parseInt(y);
 var t = 'g.p7Magic = setTimeout("scrollNow(\''+elo+'\','; 
 if ((g=objFind(el))!=null) {d=(document.layers)?g:g.style;}else{return;}
 if (parseInt(s)>0) {eval(t+x+','+y+','+a+','+b+','+c+',0)",' + s+')');return;}
 var xx=(parseInt(d.left))?parseInt(d.left):0;
 var yy=(parseInt(d.top))?parseInt(d.top):0;
 if(parseInt(c)==1) {x+=xx;y+=yy;m=true;c=0;}
 else if (c==2) {m=false;clearTimeout(g.p7Magic);}
 else {var i=parseInt(a);
  if (eval(g.moved)){clearTimeout(g.p7Magic);}
  if (xx<x){xx+=i;m=true;if(xx>x){xx=x;}}
  if (xx>x){xx-=i;m=true;if(xx<x){xx=x;}}
  if (yy<y){yy+=i;m=true;if(yy>y){yy=y;}}
  if (yy>y){yy-=i;m=true;if(yy<y){yy=y;}}}
 if (m){if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1)&& navigator.userAgent.indexOf("Opera")==-1){
    xx+="px";yy+="px";}
  d.left=xx;d.top=yy;g.moved=true;eval(t+x+','+y+','+a+','+b+','+c+',0)",'+b+')');
  }else {g.moved=false;}
}

/*
	domCollapse()
	written by Christian Heilmann
	with help from Scott Benish and Craig Saila of the webdesign-L list
	homepage: http://www.onlinetools.org/tools/domcollapse.php
*/
function domCollapse(which){
	if (document.getElementById && document.createTextNode){
		if (which=="dispall") {domCollapseAll(1);}
		else if (which=="hideall") {domCollapseAll(0);}
		else {
			m=document.getElementById("menu");
			trig=m.getElementsByTagName("div").item(which).style.display;
			t=m.getElementsByTagName("h2").item(which);
			h=t.getElementsByTagName("a").item(0).firstChild;
			if (trig=="block") trig="none";
			else if (trig=="" || trig=="none") trig="block";
			if (trig=="none"){
				h.nodeValue=h.nodeValue.replace(highlighttext,normaltext);
				t.style.background=normalbackground;
				t.style.color=normalcolour;
				}
			else {
				h.nodeValue=h.nodeValue.replace(normaltext,highlighttext);
				t.style.background=highlightbackground;
				t.style.color=highlightcolour;
				}
			m.getElementsByTagName("div").item(which).style.display=trig;
		}
	}
} 

/*
	function domCollapseAll(show)
*/
function domCollapseAll(show){
	if (document.getElementById && document.createTextNode){
		m=document.getElementById("menu");
		for (i=0;i<m.getElementsByTagName("div").length;i++){
			t=m.getElementsByTagName("h2").item(i);
			h=t.getElementsByTagName("a").item(0).firstChild;
			if (show==1){
				h.nodeValue=h.nodeValue.replace(normaltext,highlighttext);
				t.style.background=highlightbackground;
				t.style.color=highlightcolour;
				m.getElementsByTagName("div").item(i).style.display="block";
			}
			else {
				h.nodeValue=h.nodeValue.replace(highlighttext,normaltext);
				t.style.background=normalbackground;
				t.style.color=normalcolour;
				m.getElementsByTagName("div").item(i).style.display="none";
			}
		}
	}
}
// Adding backwards compatibility
if (document.getElementById && document.createTextNode){
	document.write('<style type="text/css">#menu div{display:none;}</style>')
	}

//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
