/* Compressed by the perl version of jsmin. */
//	AK Start (ISI_001_FTP) (ISI_002_DOWNLOAD) (ISI_010_ZIP)
//
//	Downloads all images, based on checkboxes with name formElement
//
	var imageArray0 = new Array();
	var imageArray1 = new Array();
	var imageArray2 = new Array();
	var imageList0 = "";
	var imageList1 = "";
	var imageList2 = "";
	var isBlocked = false;

function downloadAllImages(inputURL, formElement)   {
	var formName=getThumbnailFormId();
	var elFrm=document.getElementById(formName);
	var i;
	var arrayindex = 0;
	var max = elFrm.elements.length;
	imageArray0 = new Array();
	imageArray1 = new Array();
	imageArray2 = new Array();

	for(i=0; i<max; ++i) {
		var ourEl=elFrm.elements[i];
		if(ourEl.type=="checkbox") {
		if(ourEl.name.indexOf(formElement)!=-1) {
			if (arrayindex == 0) {
				arrayindex = 1;
				imageArray0.push(ourEl.value);
			} else {
			if (arrayindex == 1) {
				arrayindex = 2;
				imageArray1.push(ourEl.value);
			} else {
			if (arrayindex == 2) {
				arrayindex = 0;
				imageArray2.push(ourEl.value);
			}
		}
		}
		}
		}
	}
	max = imageArray0.length;
	if (max == 0) { return; }
//	document.isi.loader0.value = "";
//	document.isi.loader1.value = "";
//	document.isi.loader2.value = "";

	imageList0 = imageArray0.toString();
	imageList1 = imageArray1.toString();
	imageList2 = imageArray2.toString();

	downloadFrame(inputURL, imageList0, imageList1, imageList2);

//	gateDownload(imageList0, 0);
//	if (imageArray1.length >0) {
//		setTimeout('gateDownload(imageList1, 1);', 1500);
//	}
//	if (imageArray2.length >0) {
//		setTimeout('gateDownload(imageList2, 2);', 3000);
//	}
}

function downloadFrame(inputURL, inputArray0, inputArray1, inputArray2) {
	downloadWindow = window.open("","downloadWindow",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=50,left=50,top=10');
	if (downloadWindow == null) {
		alert ("Download pop-up blocked.");
		isBlocked = true;
		return;
	}
	inputIndex = "splat";
	downloadWindow.document.write("<HTML>");	
	downloadWindow.document.write("<HEAD><TITLE>Download All Lightbox Images</TITLE>");
	downloadWindow.document.write("<script type=\"text/javascript\" language=\"javascript\" src=\""+inputURL+"resources/themes/illuminix/javascript/pixaria.global.js\"></script>");
	downloadWindow.document.write("<SCRIPT>");
	downloadWindow.document.write("var isDone0 = false;");
	downloadWindow.document.write("var isDone1 = false;");
	downloadWindow.document.write("var isDone2 = false;");
	downloadWindow.document.write("function closeActive() {");
	downloadWindow.document.write("  if (isDone0 && isDone1 && isDone2) {");
	downloadWindow.document.write("  window.close(); } }");
	downloadWindow.document.write("</SCRIPT></HEAD>");
	downloadWindow.document.write("<FRAMESET cols=200,200,200 border=0>");
	downloadWindow.document.write("<FRAME name=download0 src=\""+inputURL+"downloadAll.php?array="+inputArray0+"&index=0&wait=0\" scrolling=no>");
	downloadWindow.document.write("<FRAME name=download1 src=\""+inputURL+"downloadAll.php?array="+inputArray1+"&index=1&wait=2\" scrolling=no>");
	downloadWindow.document.write("<FRAME name=download2 src=\""+inputURL+"downloadAll.php?array="+inputArray2+"&index=2&wait=4\" scrolling=no>");
	downloadWindow.document.write("</FRAMESET></HTML>");
	downloadWindow.document.close();
	downloadWindow.focus();
}

function ftpImages(formElement, baseURL)   {
	var formName=getThumbnailFormId();
	var elFrm=document.getElementById(formName);
	var i;
	var max = elFrm.elements.length;
	ftpArray = new Array();
	for(i=0; i<max; ++i) {
		var ourEl=elFrm.elements[i];
		if(ourEl.type=="checkbox") {
		if(ourEl.name.indexOf(formElement)!=-1) {
				if (ourEl.checked == true) {
				ftpArray.push(ourEl.value);
				}
			}
		}
	}
	max = ftpArray.length;
	if (max == 0) {
		alert ("No images selected for FTP.");
		return;
	}
//	window.location = "http://www.isiphotos.net/images/index.lightbox.php?cmd=FTPLightbox&image_id_list=" + ftpArray.toString() + "&extension=jpg";
	currentURL = baseURL + "index.lightbox.php?cmd=FTPLightbox&image_id_list=" + ftpArray.toString() + "&extension=jpg";
	window.location = currentURL;
}
function ftpExecute(inputCommand) {
	if (document.isiftpform.ftpserver.value == "") {
		alert ("Server information required.");
		return;
	}
	if (document.isiftpform.ftpuser.value == "") {
		alert ("User information required.");
		return;
	}
	if (document.isiftpform.ftppass.value == "") {
		alert ("Password required.");
		return;
	}
	if (inputCommand == "delete" && document.isiftpform.ftpserver.value == "") {
		alert ("Select a server to delete.");
		return;
	}
	document.isiftpform.isiftpcommand.value = inputCommand;
	document.isiftpform.submit();
}
function ftpServer(inputForm, inputObject) {
	index = inputObject.selectedIndex;
	temp = inputObject.value;
	if (temp == "") { return; }
	splat = temp.split(",");
	inputForm.ftpserver.value = splat[1];
	inputForm.ftpuser.value = splat[2];
	inputForm.ftppass.value = splat[3];
	inputForm.ftpdir.value = splat[4];
}
//	ZIP collect the images
function zipImages(formElement, baseURL)   {
	var formName=getThumbnailFormId();
	var elFrm=document.getElementById(formName);
	var i;
	var max = elFrm.elements.length;
	zipArray = new Array();
	for(i=0; i<max; ++i) {
		var ourEl=elFrm.elements[i];
		if(ourEl.type=="checkbox") {
		if(ourEl.name.indexOf(formElement)!=-1) {
				if (ourEl.checked == true) {
				zipArray.push(ourEl.value);
				}
			}
		}
	}
	max = zipArray.length;
	if (max == 0) {
		alert ("No images selected for ZIP.");
		return;
	}
//	window.location = "http://www.isiphotos.net/images/index.lightbox.php?cmd=ZIPLightbox&image_id_list=" + ftpArray.toString() + "&extension=jpg";
	currentURL = baseURL + "index.lightbox.php?cmd=ZIPLightbox&image_id_list=" + zipArray.toString() + "&extension=jpg";
	window.location = currentURL;
}
//	ZIP create and download
function zipExecute(inputCommand) {
	if (document.isizipform.zipname.value == "") {
		alert ("Zip file name required.");
		return;
	}
	document.isizipform.isizipcommand.value = inputCommand;
	document.isizipform.submit();
}
//	AK End (ISI_001_FTP) (ISI_002_DOWNLOAD) (ISI_010_ZIP)



function toggleLarge(set_thumb_per_page,set_gallery_per_page){if(document.getElementById('gallery-large')){Effect.Appear('gallery-large',{duration:0.0});Effect.Fade('gallery-small',{duration:0.0});}
if(document.getElementById('image-large')){Effect.Appear('image-large',{duration:0.0});Effect.Fade('image-small',{duration:0.0});}}
function toggleSmall(set_thumb_per_page,set_gallery_per_page){if(document.getElementById('gallery-large')){Effect.Appear('gallery-small',{duration:0.0});Effect.Fade('gallery-large',{duration:0.0});}
if(document.getElementById('image-large')){Effect.Appear('image-small',{duration:0.0});Effect.Fade('image-large',{duration:0.0});}}
function updateCookie(cookieKey,cookieValue,cookieDefault){cookieKey=parseInt(cookieKey);var pixariaCookie=readCookie('psg_prefs');if(!pixariaCookie){createCookie('psg_prefs',cookieDefault,360);var pixariaCookie=cookieDefault;}
var cookieElements=pixariaCookie.split("|");var cookieVersion=cookieElements[0];var imagesPerPage=cookieElements[1];var galleriesPerPage=cookieElements[2];var viewThumbView=cookieElements[3];if(cookieKey==1){cookieData='1|'+cookieValue+'|'+galleriesPerPage+'|'+viewThumbView;}
if(cookieKey==2){cookieData='1|'+imagesPerPage+'|'+cookieValue+'|'+viewThumbView;}
if(cookieKey==3){cookieData='1|'+imagesPerPage+'|'+galleriesPerPage+'|'+cookieValue;}
createCookie('psg_prefs',cookieData,360)}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function eraseCookie(name){createCookie(name,"",-1);}
function imagePreviewWindow(strFile,nWidth,nHeight){width=parseInt(nWidth)-2;height=parseInt(nHeight)-2;window.open(strFile,"Image","toolbar=no,location=no,directories=no,menubar=no,status=yes,scrollbars=no,resizable=no,width="+width+",height="+height);}
function confirmSubmit(theCommand)
{var msg=theCommand;return confirm(msg);}
function openPop(strFile,nWidth,nHeight,bStatus,bscroll,btoolbar,blocation,bresize,bdirectories,bmenubar){window.open(strFile,"help","toolbar="+btoolbar+",location="+blocation+",directories="+bdirectories+",menubar="+bmenubar+",status="+bStatus+",scrollbars="+bscroll+",resizable="+bresize+",width="+nWidth+",height="+nHeight);}
function textCounter(field,countfield,maxlimit){if(field.value.length>maxlimit)
field.value=field.value.substring(0,maxlimit);else
countfield.value=maxlimit-field.value.length;}
var DHTML=(document.getElementById||document.all||document.layers);function getObj(name)
{if(document.getElementById)
{this.obj=document.getElementById(name);this.style=document.getElementById(name).style;}
else if(document.all)
{this.obj=document.all[name];this.style=document.all[name].style;}
else if(document.layers)
{this.obj=document.layers[name];this.style=document.layers[name];}}
function selectAllImages(formElement){setAllSelect(true,formElement);}
function deselectAllImages(formElement){setAllSelect(false,formElement);}
function setAllSelect(state,formElement){var formName=getThumbnailFormId();var elFrm=document.getElementById(formName);for(var i=0;i<elFrm.elements.length;i++){var ourEl=elFrm.elements[i];if(ourEl.type=="checkbox")
if(ourEl.name.indexOf(formElement)!=-1)
ourEl.checked=state;}}
function getSelectedImages(){var formName=getThumbnailFormId();var elFrm=document.getElementById(formName);var strParams="";for(var i=0;i<elFrm.elements.length;i++){var ourEl=elFrm.elements[i];if(ourEl.type=="checkbox")
if(ourEl.checked&&(ourEl.name.indexOf("photoid[]")!=-1))
strParams=strParams+ourEl.value+",";}
strParams=strParams.substr(0,strParams.length-1);return strParams;}
function addSelectionToLightbox(){var formName=getThumbnailFormId();var elFrm=document.getElementById(formName);elFrm.submit();}
function removeSelectionFromLightbox(){var formName=getThumbnailFormId();var elFrm=document.getElementById(formName);elFrm.submit();}
function getThumbnailFormId(){if(document.getElementById('image-small')==null){return'thumb_grid_large';}else if(document.getElementById('image-large')==null){return'thumb_grid_small';}
var thumbsFormSmall=new getObj('image-small');var thumbsFormLarge=new getObj('image-large');if(thumbsFormSmall.style.display=='none'){return'thumb_grid_large';}else{return'thumb_grid_small';}}
function getSelectedCheckbox(buttonGroup){var retArr=new Array();var lastElement=0;if(buttonGroup[0]){for(var i=0;i<buttonGroup.length;i++){if(buttonGroup[i].checked){retArr.length=lastElement;retArr[lastElement]=i;lastElement++;}}}else{if(buttonGroup.checked){retArr.length=lastElement;retArr[lastElement]=0;}}
return retArr;}
function getSelectedCheckboxValue(buttonGroup){var retArr=new Array();var selectedItems=getSelectedCheckbox(buttonGroup);if(selectedItems.length!=0){retArr.length=selectedItems.length;for(var i=0;i<selectedItems.length;i++){if(buttonGroup[selectedItems[i]]){retArr[i]=buttonGroup[selectedItems[i]].value;}else{retArr[i]=buttonGroup.value;}}}
return retArr;}
function changeCSS(theClass,element,value){var cssRules;if(document.all){cssRules='rules';}
else if(document.getElementById){cssRules='cssRules';}
for(var S=0;S<document.styleSheets.length;S++){for(var R=0;R<document.styleSheets[S][cssRules].length;R++){if(document.styleSheets[S][cssRules][R].selectorText==theClass){document.styleSheets[S][cssRules][R].style[element]=value;}}}}
Event.observe(window,'load',function(){changeCSS('.thumbnail','background','#FFF');},false);var Fabtabs=Class.create();Fabtabs.prototype={initialize:function(element){this.element=$(element);var options=Object.extend({},arguments[1]||{});this.menu=$A(this.element.getElementsByTagName('a'));var loader=document.getElementById('loader');loader.style.display='none';this.show(this.getInitialTab());this.menu.each(this.setupTab.bind(this));},setupTab:function(elm){Event.observe(elm,'click',this.activate.bindAsEventListener(this),false)},activate:function(ev){var elm=Event.findElement(ev,"a");Event.stop(ev);this.show(elm);this.menu.without(elm).each(this.hide.bind(this));},hide:function(elm){$(elm).removeClassName('active-tab');$(this.tabID(elm)).removeClassName('active-tab-body');},show:function(elm){$(elm).addClassName('active-tab');$(this.tabID(elm)).addClassName('active-tab-body');},tabID:function(elm){return elm.href.match(/#(\w.+)/)[1];},getInitialTab:function(){if(document.location.href.match(/#(\w.+)/)){var loc=RegExp.$1;var elm=this.menu.find(function(value){return value.href.match(/#(\w.+)/)[1]==loc;});return elm||this.menu.first();}else{return this.menu.first();}}}
Event.observe(window,'load',function(){if(document.getElementById('tab-container')){new Fabtabs('tabs');}},false);