<!--//
/*********************************************************
JavaScript Tab Tables

Application: ASP Inline Calendar
Info: http://www.aaronoutpost.com/ASP/Programs/calendar.asp
*********************************************************/
//-->


var numberOfTabs = tabProp.length;
var FieldRequiredText = "Required";

//Function to format text in the text box
function FormatPreviewDetails(command, option){
	
  	frames.previewDetails.document.execCommand(command, true, option);
  	frames.previewDetails.focus();
}

//Function to Insert Image in Preview
function AddImageShort(){	
	imagePath = prompt('Please enter the address of the image:', 'http://');				
	
	if ((imagePath != null) && (imagePath != "")){					
		frames.previewDetails.document.execCommand('InsertImage', false, imagePath);
  		frames.previewDetails.focus();
	}
	frames.previewDetails.focus();			
}

//Function to format text in the text box
function FormatDetails(command, option){
	
  	frames.message.document.execCommand(command, true, option);
  	frames.message.focus();
}


//Function to Insert Image in Full Details View
function AddImage(){	
	imagePath = prompt('Please enter the address of the image:', 'http://');				
	
	if ((imagePath != null) && (imagePath != "")){					
		frames.message.document.execCommand('InsertImage', false, imagePath);
  		frames.message.focus();
	}
	frames.message.focus();			
}

//Function to Play Sounds
function PlaySound(path) {//v1.0
 var b,d=document,e,es,i,se="<EMBED SRC='"+path+"' HIDDEN=TRUE LOOP=FALSE AUTOSTART=TRUE>";			
 if(d.body)b=d.body;	if(d.getElementsByTagName) { es=d.getElementsByTagName('embed')		
 for(i=0;i<es.length;i++) { e=es(i); if( e.src==path ) { if(e.removeNode) e.removeNode();
 break; } } if(b&&b.insertAdjacentHTML) b.insertAdjacentHTML("beforeend",se); }
}

//Function to Set Event Title as Required
function SetRequired(field) {
	if (field.value == "") {
		field.value = FieldRequiredText
	}
}
function ClearRequired(field) {
	if (field.value == FieldRequiredText) {
		field.value = ""
	}
}


//Cool Table Tabs
if (numberOfTabs > 10) numberOfTabs = 10;

if (NavVerifyWidth == 1) if (parseInt(NavWidth) * numberOfTabs + parseInt(NavSpacing) * numberOfTabs + parseInt(NavLeftOffset) > parseInt(contentWidth)) contentWidth = parseInt(NavWidth) * numberOfTabs + parseInt(NavSpacing) * numberOfTabs + parseInt(NavLeftOffset) + 'px';

// Initiate Navigation Tabs
function StartTables() {
   var initTab = NavSelected;
	
   for (var i = 0; i < numberOfTabs; i++) { 
		SetStyle(tabProp[i][0],'backgroundColor',NavBgColorOff);
		SetStyle(tabProp[i][0],'borderBottom', NavBorderStyle + " " + NavBorderColor);
		SetStyle(tabProp[i][0],'borderLeft', NavBorderStyle + " " + NavBorderColor);
		SetStyle(tabProp[i][0],'borderRight', NavBorderStyle + " " + NavBorderColor);
		SetStyle(tabProp[i][0],'borderTop', NavBorderStyle + " " + NavBorderColor);
		SetStyle(tabProp[i][0],'color',NavFontColorOff);
		SetStyle(tabProp[i][0],'fontFamily',NavFontFamily);
		SetStyle(tabProp[i][0],'fontSize',NavFontSize);
		SetStyle(tabProp[i][0],'height',NavHeight);
		SetStyle(tabProp[i][0],'marginRight',NavSpacing);
		SetStyle(tabProp[i][0],'width',NavWidth);
		SetStyle(tabProp[i][3],'display','none');
     } 
	SetClass(tabProp[initTab][0],'tabNavOn');
	SetStyle(tabProp[initTab][0],'backgroundColor', tabProp[initTab][2]);
	SetStyle(tabProp[initTab][0],'borderBottom', NavBorderStyle + " " + tabProp[initTab][2]); 
	SetStyle(tabProp[initTab][0],'color',NavFontColorOn);

	SetStyle(tabProp[initTab][3],'display','block');
	SetStyle('tabContent','backgroundColor', tabProp[initTab][2]); 
	SetStyle('tabContent','border', NavBorderStyle + " " + NavBorderColor);
	SetStyle('tabContent','color',contentFontColor);
	SetStyle('tabContent','fontFamily',contentFontFamily);
	SetStyle('tabContent','fontSize',contentFontSize);
	SetStyle('tabContent','height',contentHeight);
	SetStyle('tabContent','padding',contentPadding);
	SetStyle('tabContent','width', contentWidth);
	SetStyle('tabOffset','width',NavLeftOffset);


}

//Navigate on Click
function ttSetNav(tabID) {
   for (var i = 0; i < numberOfTabs; i++) { 
		SetClass(tabProp[i][0],'tabNavOff');
		SetStyle(tabProp[i][3],'display','none');
		SetStyle(tabProp[i][0],'backgroundColor',NavBgColorOff);	
		SetStyle(tabProp[i][0],'borderBottom', NavBorderStyle + " " + NavBorderColor);
		SetStyle(tabProp[i][0],'color',NavFontColorOff);
      } 
	SetStyle(tabProp[tabID][3],'display','block');
	SetClass(tabProp[tabID][0],'tabNavOn');
	SetStyle(tabProp[tabID][0],'backgroundColor', tabProp[tabID][2]);
	SetStyle(tabProp[tabID][0],'borderBottom', NavBorderStyle + " " + tabProp[tabID][2]);
	SetStyle(tabProp[tabID][0],'color',NavFontColorOn);
	SetStyle('tabContent','backgroundColor', tabProp[tabID][2]);
}

//Display Tab Navs
function TableDisplay() {
	for (var i = 0; i < numberOfTabs; i++) { 
	document.write("<div class=\"tabNavOff\" id=\"tabNav" + i + "\" onclick=\"ttSetNav(" + i + "); PlaySound('sounds/NAVIGATION.WAV')\" onMouseOver=\"NavOver('tabNav" + i + "', '" + tabProp[i][2] + "') \" onMouseOut=\"NavOut('tabNav" + i + "',NavBgColorOff)\" title=\"" + tabProp[i][1] + "\">" + tabProp[i][1] + "</div>");
	}
}

//Classes and Styles
function SetClass(objectID,newClass) {
	var object = document.getElementById(objectID);
	object.className = newClass;
}

function SetStyle(objectID,styleName,newVal) {
	var object = document.getElementById(objectID);
	object.style [styleName] = newVal;
}

//Mouse Over Functions
function NavOver(objectID,bgcolor) {
   SetStyle(objectID,'backgroundColor',bgcolor);
}

//Mouse Out Functions
function NavOut(objectID,bgcolor) {
   var status = document.getElementById(objectID).className;
   if (status != "tabNavOn")  SetStyle(objectID,'backgroundColor',bgcolor);
}
