///////////////////////////////////////
// WARNING -- DO NOT EDIT /////
//////////////////////////////////////

/// Javascript functions 1.6
// This template sets the Javascript functions which appear in 
// the <head> of every page. If you need to add any global 
// javascript statements, do it here.
//

// Break out of frames
// if (window!= top)
// top.location.href=location.href

// Trim input text to avoid hacks
function Trim(text) {
var maxlength = 3072; // Change number to your max length.
if (text.value.length > maxlength) 
text.value = text.value.substring(0,maxlength);
} 

///////////////////////////////////////////////////////////
//         Moveable Type Comment functions         //
///////////////////////////////////////////////////////////

function OpenComments (c) {
    window.open('http://s105698645.onlinehome.us/cgi-bin/mt266/mt-comments.cgi?' +
                    'entry_id=' + c,
                    'comments',
                    'width=480,height=480,scrollbars=yes,status=yes');
}

var HOST = 'www.csminspections.com';
var expdate = new Date ();
var killdate = new Date ();
expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000*365)); // Year from now
killdate.setTime (killdate.getTime() - (24 * 60 * 60 * 1000*365)); // Year ago

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    setCookie('mtcmtauth', f.author.value, now, '', HOST, '');
    setCookie('mtcmtmail', f.email.value, now, '', HOST, '');
    setCookie('mtcmthome', f.url.value, now, '', HOST, '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '', HOST);
    deleteCookie('mtcmthome', '', HOST);
    deleteCookie('mtcmtauth', '', HOST);
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

///////////////////////////////////////////////////////////


// Jump Menu Functions
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v3.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function vidPlayer (v,p) {
if (p == "wmv") {
if (navigator.appName == "Netscape") {
  document.write('<APPLET NAME="Player" HEIGHT="240" WIDTH="320" CODE="WMPNS.WMP">');
  document.write('  <PARAM NAME="URL" value="/membervids/' + v + '.wmv"/>');
  document.write('</APPLET>');
} else {
  document.write('<OBJECT ID="Player" height="480" width="555" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">');
  document.write('  <PARAM name="URL" value="/membervids/' + v + '.wmv"/>');
  document.write('  <PARAM name="stretchToFit" value="true"/>');
  document.write('</OBJECT>');
}
} else {
  document.write('<EMBED '); 
  document.write('scale="tofit" ');
  document.write('width="400" height="300" ');
  document.write('autoplay="true" '); 
  document.write('controller="true" '); 
  document.write('type="application/x-rtsp" '); 
  document.write('src="' + v + '_ref.mov" ');
  document.write('qtsrc="rtsp://whenifeelsexy.com:554/' + v + '.mov"> ');
  document.write('</EMBED>');
}
}

function vidPlayerSm (v,p) {
if (p == "wmv") {
if (navigator.appName == "Netscape") {
  document.write('<APPLET NAME="Player" HEIGHT="160" WIDTH="208" CODE="WMPNS.WMP">');
  document.write('  <PARAM NAME="URL" value="/membervids/' + v + '_sm.wmv" />');
  document.write('</APPLET>');
} else {
  document.write('<OBJECT ID="Player" height="480" width="555" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">');
  document.write('  <PARAM name="URL" value="/membervids/' + v + '_sm.wmv" />');
  document.write('  <PARAM name="stretchToFit" value="true"/>');
  document.write('</OBJECT>');
}
} else {
  document.write('<EMBED '); 
  document.write('scale="tofit" ');
  document.write('width="400" height="300" ');
  document.write('autoplay="true" '); 
  document.write('controller="true" '); 
  document.write('type="application/x-rtsp" '); 
  document.write('src="' + v + '_sm_ref.mov" ');
  document.write('qtsrc="rtsp://whenifeelsexy.com:554/' + v + '_sm.mov"> ');
  document.write('</EMBED>');
}
}

var exit=false;
function exitcon() {
if (exit) {
 
}
}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
		{
	    	if(document.layers)	   //NN4+
	    		{
	       		document.layers[szDivID].display = iState ? "show" : "hide";
	    		}
	    	else if(document.getElementById)	  //gecko(NN6) + IE 5+
	    		{
	        	var obj = document.getElementById(szDivID);
	        	obj.style.display = iState ? "block" : "none";
    			}
    		else if(document.all)	// IE 4
    			{
		        document.all[szDivID].style.display = iState ? "block" : "none";
	    		}
		}
		
		function checkIfAdding() {
	
			if (document.select.memberID.value == 'add') {
			document.changepass.newpass.disabled = true;
			document.changepass.vpass.disabled = true;
			document.changepass.submit.disabled = true;
			document.select.edit.disabled = true;	
				
				
			} else {
			document.changepass.newpass.disabled = false;
			document.changepass.vpass.disabled = false;
			document.changepass.submit.disabled = false;
			document.select.edit.disabled = false;
				
				
			}	
}


function checkAgree(form,msg) {
	if ( !form.tosagree.checked ){ 
	alert(msg);
	return false;
	}
}

