var IE6 = false /*@cc_on || @_jscript_version != 5.7 @*/;	// exactly IE6
var IE7 = false /*@cc_on || @_jscript_version == 5.7 @*/;	// exactly IE7
var gteIE7 = false /*@cc_on || @_jscript_version >= 5.7 @*/;	// at least IE7
var isMSIE = /*@cc_on!@*/false;					// any IE

function addEvent(obj, evType, fn){
	 if (obj.addEventListener){
		 obj.addEventListener(evType, fn, true);
		 return true;
	 } else if (obj.attachEvent){
		 var r = obj.attachEvent("on"+evType, fn);
		return r;
	 } else {
		return false;
	 }
}
function get(str){
	return document.getElementById(str);
}
function getN(str){
	return document.getElementsByName(str);
}
function hideShow(){
	get('mustLogIn').style.display = 'none';
	get('notLoggedIn').style.display = 'block';
}
function nliHide(){
	get('mustLogin2').style.display='block';
	get('badLogin').style.display='none';
}
function logMeIn(){
	var f = document.getElementById("f");
	if(get('username').value != '' && get('password').value != ''){
	    f.submit();
	    get('notLoggedIn').style.display = 'none';
	    //get('badLogIn').style.display = 'none';
	} else {
	    alert('Please enter a username and password.');
	}
}
function checkKey(evt){
	if (evt.keyCode == 13){
	    logMeIn();
	}
}

//APPOINTMENT FORM VALIDATION
function validate(){
  var f = document.getElementById("f");
  na = f.name.value;
  ph = f.phone.value;
  em = f.email.value;

function isEmail(strValue){
  var objRegExp = /^[a-z0-9](.+)@[a-z0-9](.+)$/;
   return objRegExp.test(strValue);
}
function isPhone(strValue){
  return (strValue.replace(/\d\-?/g,"") == "");
}
function isNumeric(strValue){
  return (strValue.replace(/[0-9]/g,"") == "");
}
function isLetters(strValue){
 return (strValue.replace(/[A-Za-z]/g,"") == "");
}
msg=new String("");
if(na.length==0){
  msg+="Name\n ";
}
if(ph.length==0){
  msg+="Phone\n ";
}
if(em.length==0){
  msg+="E-mail\n ";
}
if(f.timing.selectedIndex < 1){
  msg+="Timing of Reconstruction\n ";
  f.timing.focus();
}
if(msg.length>1){
  msg="The following fields are required:\n "+msg;
  alert(msg);
  //event.returnValue=false;
} else {
	f.action="nvform.php";
	f.submit();
  }
}

//CONTACT FORM VALIDATION
function validateCont(){
  var f = document.getElementById("f");
  na = f.name.value;
  ph = f.phone.value;
  em = f.email.value;

function isEmail(strValue){
  var objRegExp = /^[a-z0-9](.+)@[a-z0-9](.+)$/;
   return objRegExp.test(strValue);
}
function isPhone(strValue){
  return (strValue.replace(/\d\-?/g,"") == "");
}
function isNumeric(strValue){
  return (strValue.replace(/[0-9]/g,"") == "");
}
function isLetters(strValue){
 return (strValue.replace(/[A-Za-z]/g,"") == "");
}
msg=new String("");
if(na.length==0){
  msg+="Name\n ";
}
if(ph.length==0){
  msg+="Phone\n ";
}
if(em.length==0){
  msg+="E-mail\n ";
}
if(msg.length>1){
  msg="The following fields are required:\n "+msg;
  alert(msg);
  //event.returnValue=false;
} else {
	f.action="nvform.php";
	f.submit();
  }
}

function RunFoo()
{
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="770" height="337">\n');
    document.write('<param name="movie" value="flash/main.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" />\n');
    document.write('<embed src="flash/main.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="770" height="337" wmode="transparent" />\n');
    document.write('</object>\n');
}

var TheSeparator = "/";
var TheSeparator2 = ", ";
var ShowDay ="yes";
var Days = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var TheDate = new Date();

var TheWeekDay = TheDate.getDay();
var Day ="";
if(ShowDay == "yes"){
    Day = Days[TheWeekDay];
    Day += "";}

var TheMonth = TheDate.getMonth() + 1;
if(TheMonth < 10) TheMonth = "0" + TheMonth;

var TheMonthDay = TheDate.getDate();
if(TheMonthDay < 10) TheMonthDay = "0" + TheMonthDay;

var TheYear = TheDate.getYear();
if(TheYear < 1000) TheYear += 1900;

var D = "";
D += TheYear;


function loadCurves(){
	settings5 = {
          tl: { radius: 5 },
          tr: { radius: 5 },
          bl: { radius: 5 },
          br: { radius: 5 },
          antiAlias: true,
          autoPad: true,
          validTags: ["div"]
	}
	var myBoxObjectMain = new curvyCorners(settings5, "curve5");
	myBoxObjectMain.applyCornersToAll();
}
function createXHR(xhr){
	var xhr;
	try{
		xhr = new ActiveXObject("MSXML2.XMLHTTP");
	}catch(e){
		try{
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xhr = false;
		}
	}
	if(!xhr && typeof XMLHttpRequest != 'undefined'){
		xhr = new XMLHttpRequest();
	}
	return xhr;
}
function setDiv(){
	if(xhr.readyState == 4){
		var res = xhr.responseText;
		get('content').innerHTML = res;
	}
}
var glblFile;
function getFile(id){
	var glblFile = id;
	get('myLi2').value = glblFile;
	var id2 = get('myLi2').value;

	xhr = createXHR();
	xhr.onreadystatechange = setDiv;
	xhr.open("GET","proc.php?id=" + id + "&id2=" + id2);
	xhr.send(null);
}
function goNext(id){
	var glblFile = id;
	get('myLi').value = glblFile - 1;
	get('myLi2').value = glblFile;
	var id2 = get('myLi2').value;

	if(get('myLi').value == 99 || get('myLi').value == 0 || get('myLi').value == 9){
	    getFile(99);
	} else {
	    getFile(glblFile);
	}
}
function goBack(myID){
	if(get('myLi').value == get('myLi2').value){
	    get('myLi').value = myID - 1;
	} else {
	    get('myLi').value = myID;
	}
	if(get('myLi').value == 99 || get('myLi').value == 0 || get('myLi').value == 10){
	    getFile(99);
	} else {
	    getFile(get('myLi').value);
	}
}
function setDiv3(){
	if(xhr.readyState == 4){
		var res = xhr.responseText;
		get('content').innerHTML = res;
	}
}
function getVFile(vidid){
	xhr = createXHR();
	xhr.onreadystatechange = setDiv3;
	xhr.open("GET","/videos.php?vidid=" + vidid);
	xhr.send(null);
}
function getVVFile(id){
	xhr = createXHR();
	xhr.onreadystatechange = setDiv3;
	xhr.open("GET","/videos.php?id=" + id);
	xhr.send(null);
}