<!--

// reorder the items in a select list
// used by the cms to reorder the series list
function move(f,bDir) {
	var el = f.elements["order[]"];
	if(el.length <= 0)
		return;
	var idx = el.selectedIndex
	if (idx==-1)
		alert("You must first select the item to reorder.")
	else {
		var nxidx = idx+( bDir? -1 : 1)
		if (nxidx<0) nxidx=el.length-1
		if (nxidx>=el.length) nxidx=0
		var oldVal = el[idx].value
		var oldText = el[idx].text
		el[idx].value = el[nxidx].value
		el[idx].text = el[nxidx].text
		el[nxidx].value = oldVal
		el[nxidx].text = oldText
		el.selectedIndex = nxidx
	}
}
// used to select all elements in a multi-select menu
function selectAllItems() {
	obj = document.forms["seriesform"].elements["order[]"];
	if (obj.length <= 0) return;
	for (i=0;i<obj.length;i++)
		obj.options[i].selected=true;
	document.seriesform.submit();
}

function toggleDiv(divName) {
	thisDiv = document.getElementById(divName);
	if (thisDiv) {
		if (thisDiv.style.display == "none") {
			thisDiv.style.display = "block";
		} else {
			thisDiv.style.display = "none";
		}
	} else {
		errorString = "Error: Could not locate div with id: " + divName;
		alert(errorString);
	}
}

function toggleMenuSection(unique) {
	action = "toggleType = toggleDiv('div_" + unique + "');";
	eval(action);
	action = "thisImage = document.getElementById('img_" + unique + "');";
	eval(action);
	if (document.getElementById('div_' + unique).offsetHeight > 0) {
		thisImage.src = "/sorpetalerusa/images/cms_iconcontract.gif";
	} else {
		thisImage.src = "/sorpetalerusa/images/cms_iconexpand.gif";
	}
}

function flashArchives() {
	for (i = 0; i < 8; i++) {
		if (i % 2 == 0) {
			setTimeout("document.getElementById('archives').style.background='#569';", i*150);
		} else {
			setTimeout("document.getElementById('archives').style.background='#89c';", i*150);
		}
	}
}

function splashCaption(thisLi) {
	var captions = new Array("tasks","photos","hacks","ritm");
	if (thisLi) {
		for (i = 0; i < captions.length; i++) {
			if ("splash_" + captions[i] == thisLi.id) {
				document.getElementById("splash_text").innerHTML = thisLi.childNodes[1].innerHTML;
				// document.getElementById("splash_" + captions[i]).childNodes[0].childNodes[0].src = "images/clear.gif";
			} else {
			// document.getElementById("splash_" + captions[i]).childNodes[0].childNodes[0].src = "home/splash_screen.gif";
			}
		}
	} else {
		for (i = 0; i < captions.length; i++) {
			document.getElementById("splash_" + captions[i]).childNodes[0].childNodes[0].src = "images/clear.gif";
		}
		document.getElementById("splash_text").innerHTML = "Click for more information.";
	}
}

function activateSubNav(id) {
	for (i = 0; i < tabs.length; i++) {
		if (document.getElementById(tabs[i])) {
			if (id == 'init') {
				var sURL = location.href;
				var anchorLocation = sURL.indexOf('#');
				if (anchorLocation > -1) {
					var tab = sURL.substring((anchorLocation + 1), sURL.length);
					activateSubNav(tab);
				} else {
					activateSubNav('wp_100');
				}
				i = tabs.length;
			} else if (id == tabs[i]) {
				document.getElementById(tabs[i]).style.display = "block";
				document.getElementById(tabs[i] + "_tab").className += " active";
			} else {
				document.getElementById(tabs[i]).style.display = "none";
				document.getElementById(tabs[i] + "_tab").className = document.getElementById(tabs[i] + "_tab").className.replace(/active/g, "");
			}
		}
	}
}

function slvBanner() {
	var posts = slvGetCookie('wplastvisit_posts');
	var comments = slvGetCookie('wplastvisit_comments');
	if (posts == null || comments == null) {
		return false;
	}
	var banner = '';
	if (posts == 1) {
		banner += posts + ' new post and ';
	} else {
		banner += posts + ' new posts and ';
	}
	if (comments == 1) {
		banner += comments + ' new comment since your last visit.';
	} else {
		banner += comments + ' new comments since your last visit.';
	}
	document.write(banner);
}

function slvShowNewIndicator(date) {
	if (parseInt(date) > parseInt(slvGetCookie('wplastvisit'))) {
		document.write('<img src="/blog/ak-img/new.gif" alt="New" title="New since your last visit." />');
	}
}

function slvGetCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {
		end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
}

function email(a, b, c, d, show) { // try to avoid spam trollers, intentionally complex
	if (!show) {
		show = a + b + c + d;
	}
	e_string = "<a href=\"ma" + "ilto:" + a + b + c + d + "\">" + show + "</a>";
	document.write(e_string);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

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 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_preloadImages() { //v3.0
	var d=document;
	if (d.images) {
		if (!d.MM_p) d.MM_p = new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
		for (i=0; i<a.length; i++) {
			if (a[i].indexOf("#") != 0) {
				d.MM_p[j]= new Image;
				d.MM_p[j++].src=a[i];
			}
		}
	}
}

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;
   }
}

aDr = new Array(30);
sP = new Array(8);

//lIST OF START POINTS FOR THE VARIOUS SELECTIONS
//NOTE: last entry is fictious start point point of future additional selects
//If you understand the system you can even use various selections for more than one form 
//with a little playing around with the sP array. Every use uses two sP values. The way it is
//written I double use each and go in order. You can have pairs of start stop sP values though.

sP[0] = 0;
sP[1] = 5;
sP[2] = 9;
sP[3] = 12;
sP[4] = 20;
sP[5] = 21;
sP[6] = 24;
sP[7] = 27;
sP[8] = 30;

aDr[0] = new Set2val('Sel0','Selection 0');
aDr[1] = new Set2val('Sel1','Selection 1');
aDr[2] = new Set2val('Sel2','Selection 2');
aDr[3] = new Set2val('Sel3','Selection 3');
aDr[4] = new Set2val('Sel4','Selection 4');

aDr[5] = new Set2val('Sel5','Selection 5');
aDr[6] = new Set2val('Sel6','Selection 6');
aDr[7] = new Set2val('Sel7','Selection 7');
aDr[8] = new Set2val('Sel8','Selection 8');

aDr[9] = new Set2val('Sel9','Selection 9');
aDr[10] = new Set2val('Sel10','Selection 10');
aDr[11] = new Set2val('Sel11','Selection 11');

aDr[12] = new Set2val('Sel12','Selection 12');
aDr[13] = new Set2val('Sel13','Selection 13');
aDr[14] = new Set2val('Sel14','Selection 14');
aDr[15] = new Set2val('Sel15','Selection 15');
aDr[16] = new Set2val('Sel16','Selection 16');
aDr[17] = new Set2val('Sel17','Selection 17');
aDr[18] = new Set2val('Sel18','Selection 18');
aDr[19] = new Set2val('Sel19','Selection 19');

aDr[20] = new Set2val('Sel20','Selection 20');

aDr[21] = new Set2val('Sel21','Selection 21');
aDr[22] = new Set2val('Sel22','Selection 22');
aDr[23] = new Set2val('Sel23','Selection 23');

aDr[24] = new Set2val('Sel24','Selection 24');
aDr[25] = new Set2val('Sel25','Selection 25');
aDr[26] = new Set2val('Sel26','Selection 26');

aDr[27] = new Set2val('Sel27','Selection 27');
aDr[28] = new Set2val('Sel28','Selection 28');
aDr[29] = new Set2val('Sel29','Selection 29');

function Set2val(V1,V2) {	
	this.Id = V1;
	this.Description = V2;
}

function SelDrop(Sels,fn,sname,snum) {
	NewListad = eval("document." + fn + "." + sname);
	NewListad.options.length = 0;
	if (Sels.selectedIndex > 0) {
		nP = Sels.selectedIndex + snum;
		nsn = sP[nP - 1];
		nen = sP[nP];
		for (i1 = nsn; i1 < nen; i1++) {		
			NewListad.options[i1 - nsn] = new Option(aDr[i1].Description,aDr[i1].Id);
		}
	}
}

//-->

