// JavaScript Function Library
VENDOR = ''

// Check DOM support
if 	(document.getElementById)	DOMS = 3	// Supports Web Standard
else if	(document.all)		DOMS = 2	// Supports MS document.all
else if	(document.layers)	 	DOMS = 0	// Supports NS layers
else				DOMS = 0;	// No DOM gateway support

// Return DOM object pointer for appropriate DOM interface
function getObj(s) {
  switch(DOMS) { 
    case 1: return(document[s]);
    case 2: return(document.all[s]);
    case 3: return(document.getElementById(s));
  }
}

// Reset input field color when changed
function fldReset() { this.style.backgroundColor=''; this.style.borderColor='#bbbbbb'; }

// display error message, color error field, set 
function setErm(f,m) {
  alert(m);
  f.onchange = fldReset;
  f.style.backgroundColor="#ff9"; 
  f.style.borderColor="#f00"; 
  f.focus(); 
  return false;
}

// Check mailto form field(s) for required input, When a field is found with missing input,
// alert user, set field pink, and set focus to it.
function chkMailform(s) {
   if (s.Name.value=='')		return setErm(s['Name'],		'You must enter your name to continue.')
   if (s.Telephone.value=='')		return setErm(s['Telephone'],		'You must enter your daytime phone number to continue.')
   if (s.EveTelephone.value=='')	return setErm(s['EveTelephone'],	'You must enter your evening phone number to continue.')
   if (s['MM_EMAILTO[]'][1].value=='')	return setErm(s['MM_EMAILTO[]'][1],	'You must enter your email address to continue.')
   if (s.Email.value=='')		return setErm(s['Email'],		'You must verify your email address to continue.')
   return true;
}

function imgRot(s,pt,tm) {
  document.images[s].src = "images/"+s+"/"+pt+".jpg";
  ++pt;
  if (pt>6) { pt = 1 };
  setTimeout('imgRot("' + s + '",' + pt + ',' + tm + ')',tm);
}

function verifyDelete(s)	{ return(confirm("Are you sure you want to delete " + s + "?")); }

function editKitchenstyle(ksid)		{ window.open('admin_edit_kitchenstyle.php?ksid='+ksid ,'kitchenstyle' ,'height=500,width=500,scrollbars,resizable'); return false; }
function editDoorstyle(dsid)			{ window.open('admin_edit_doorstyle.php?dsid='+dsid ,'doorstyle' ,'height=500,width=500,scrollbars,resizable'); return false; }
function editProfileCat(pcid)			{ window.open('admin_edit_profilecat.php?pcid='+pcid,'profilecat','height=400,width=500,scrollbars,resizable'); return false; }
function editProfileGrp(pcid,pgid)		{ window.open('admin_edit_profilegrp.php?pcid='+pcid+'&pgid='+pgid,'profilegrp','height=500,width=500,scrollbars,resizable'); return false; }
function editProfileFinish(pcid,pgid,pfid)	{ window.open('admin_edit_profilefinish.php?pcid='+pcid+'&pgid='+pgid+'&pfid='+pfid,'profilefin','height=500,width=500,scrollbars,resizable'); return false; }
function editDoorFinish(dsid,dfid)	{ window.open('admin_edit_doorfinish.php?dsid='+dsid+'&dfid='+dfid,'doorfin','height=500,width=500,scrollbars,resizable'); return false; }
function editProfileSet(pcid,pgid,psid)		{ window.open('admin_edit_profileset.php?pcid='+pcid+'&pgid='+pgid+'&psid='+psid,'profilefin','height=500,width=500,scrollbars,resizable'); return false; }
function viewFinish(pfid)			{ window.open('view_finish.php?pfid='+pfid,'finish','height=390,width=195,scrollbars,resizable'); return false; }
function editTestimonial(tmid)		{ window.open('admin_edit_testimonial.php?tmid='+tmid,'testimonial','height=500,width=500,scrollbars,resizable'); return false; }
function editGallery(gid)			{ window.open('admin_edit_gallery.php?gid='+gid,'testimonial','height=500,width=500,scrollbars,resizable'); return false; }
function viewGallery(gid)			{ window.open('view_gallery.php?gid='+gid,'viewgal','height=500,width=550,scrollbars,resizable'); return false; }
