var vsb = new Image();
var hid = new Image();
vsb.src = "images/pointup.html";
hid.src = "images/pointdown.html";

var tab = new Array();

tab[0] = "general";
tab[1] = "jobInfo";
tab[2] = "design";
tab[3] = "delivery";
tab[4] = "properties";
tab[5] = "quoteDetails";
function delay(s){
	setTimeout("window.location.href='index.php'",(s*1000));
}
function highlight(what,className){
	for (var i=0;i<document.length;i++){
		alert(document.getElementById(what).type);
	}
}

function pop(where,x,y){
	if (where.substr(0,5)=='write'){
		var newwin = window.open(where,'','status=no,bookmarks=yes,menubar=yes,scrollbars=yes,width='+x+',height='+y);
	}
	else {
		var newWin = window.open(where,'','toolbar=no,status=no,bookmarks=no,scrollbars=yes,width='+x+',height='+y);
	}
}
function show(what){
	if (what==''||!document.getElementById(what))return false;
	document.getElementById(what).style.display='';
}
function forceShow(what){
	var d = document.getElementById(what);
	if (d.style.display == 'none')d.style.display='';
	else d.style.display = 'none';
}
function hide(what){
	if (what==''||!document.getElementById(what))return false;
	document.getElementById(what).style.display='none';
}
function toggle(what){
	if (document.getElementById(what).style.display == "none"){
		show(what);
		document.images[what+"Sw"].src = vsb.src;
	}
	else{
		hide(what);
		document.images[what+"Sw"].src = hid.src;
	}
}
function autoShow(what){
	if (document.getElementById(what).style.display=='none')show(what);
	else hide(what);
}
function SetCookie (name, value) {
         var argv = SetCookie.arguments;
         var argc = SetCookie.arguments.length;
         var expires = (argc > 2) ? argv[2] : null;
         var path = (argc > 3) ? argv[3] : null;
         var domain = (argc > 4) ? argv[4] : null;
         var secure = (argc > 5) ? argv[5] : false;
         document.cookie = name + "=" + escape (value) +
         ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
         ((path == null) ? "" : ("; path=" + path)) +
         ((domain == null) ? "" : ("; domain=" + domain)) +
         ((secure == true) ? "; secure" : "");
}

function setC(form) {
             var expdate = new Date ();
             expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 31));
             SetCookie (form.name, form.value, expdate);
}
function getCookieVal(offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1) endstr = document.cookie.length;
   return unescape (document.cookie.substring(offset, endstr));
}
function GetCookie(name) {
   var arg = name+"=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break;
   }
   return null;
}