/* COMMON JS CODE FOR ALL IW/QS SITES */
function IW() {
	this.siteRoot = "";
	this.customerId = "";
}

IW.prototype.AddSingleImageToLightbox = function(imageId) {
	var imageIds = [imageId];
	
	this.DoLightboxAdd(imageIds);
}

IW.prototype.AddSelectedImagesToLightbox = function() {
	//Get comma list of image IDs
	var imageIds = [];
	
	$(".chkAddToLightbox:checked").each(function(i) {
		imageIds[i] = $(this).val();
	});
	
	if (imageIds.length == 0) {
		alert('Please select one or more images.');
		return;
	}
	
	this.DoLightboxAdd(imageIds);	
}

IW.prototype.DoLightboxAdd = function(imageIds) {
	if (this.customerId != "") {
		this.AddToLightbox(imageIds);
	} else {
		window.location = this.siteRoot + "login.php?Lightbox_Unique_ID=" + imageIds;
	}
}

IW.prototype.AddToLightbox = function(imageIDs) {
	window.open(this.siteRoot + "lightbox_popup.php?Lightbox_Unique_ID=" + imageIDs, "lightboxPopup", "height=500, width=570, location=no, resizable=no, scrollbars=yes, status=no, toolbar=no, menubar=no, left=0, top=0, directories=no");
}

IW.prototype.VerifyLightboxDelete = function() {
	var FormPath;
	FormPath = document.deleteform;
	
	if(window.confirm("Are you sure you want to delete this lightbox?")) {
		FormPath.submit();
	}
}
