﻿var opacityStep = 0.02; // step amount of opacity change for fade in/out (between 0 and 1)var fadeInterval = 10; // pause time (milliseconds) between opacity changes for fade in/out// fadeInterval/(opacityStep*1000) = time to complete fadevar xhr = new Array(); // ARRAY OF XML-HTTP REQUESTSvar xi = new Array(0); // ARRAY OF XML-HTTP REQUEST INDEXESxi[0] = 1; // FIRST INDEX SET TO 1 MAKING IT AVAILABLEfunction xhrRequest(type) {	if (!type) {		type = 'html';	}	// xhrsend IS THE xi POSITION THAT GETS PASSED BACK	// INITIALIZED TO THE LENGTH OF THE ARRAY(LAST POSITION + 1)	// IN CASE A FREE RESOURCE ISN'T FOUND IN THE LOOP	var xhrsend = xi.length;	// GO THROUGH AVAILABLE xi VALUES	for (var i=0; i<xi.length; i++) {		// IF IT'S 1 (AVAILABLE), ALLOCATE IT FOR USE AND BREAK		if (xi[i] == 1) {			xi[i] = 0;			xhrsend = i;			break;		}	}	// SET TO 0 SINCE IT'S NOW ALLOCATED FOR USE	xi[xhrsend] = 0;	// SET UP THE REQUEST	if (window.ActiveXObject) {		try {			xhr[xhrsend] = new ActiveXObject("Msxml2.XMLHTTP");		} catch (e) {			try {				xhr[xhrsend] = new ActiveXObject("Microsoft.XMLHTTP");			} catch (e) {}		}	} else if (window.XMLHttpRequest) {		xhr[xhrsend] = new XMLHttpRequest();		if (xhr[xhrsend].overrideMimeType) {			xhr[xhrsend].overrideMimeType('text/' + type);		}	}	return (xhrsend);}function sample() {	var xhri = xhrRequest('html');	var qry = '';	var url = '';	xhr[xhri].open('POST', url, true);	xhr[xhri].onreadystatechange = function () {			if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {				xi[xhri] = 1;				xhr[xhri] = null;			} else {				try {					var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;					//alert(alertStr);				}				catch (e) {					var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";					//alert(alertStr);				}			}		};	xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xhr[xhri].send(qry);}//// SCROLLING//function stop_scroll() {	clearInterval(scroller);}function toggle_arrow(side) {	if (!side) side = window.event; // fix for IE	if (side == 'left') {		if (document.getElementById('arrowleft').src.substr(document.getElementById('arrowleft').src.lastIndexOf('/')) == '/arrowleft.gif') {			document.getElementById('arrowleft').src = '/pics/arrowleftw.gif';		} else {			document.getElementById('arrowleft').src = '/pics/arrowleft.gif';		}	} else {		if (document.getElementById('arrowright').src.substr(document.getElementById('arrowright').src.lastIndexOf('/')) == '/arrowright.gif') {			document.getElementById('arrowright').src = '/pics/arrowrightw.gif';		} else {			document.getElementById('arrowright').src = '/pics/arrowright.gif';		}	}}//// SCROLLING PHOTOGRAPHS//function scroll_right() {	scroller = setInterval(function() {		var temp_var = js_ids.shift();		js_ids.push(temp_var);		temp_var = js_filenames.shift();		js_filenames.push(temp_var);		temp_var = js_titles.shift();		js_titles.push(temp_var);		var out_string = '<table cellpadding="8px"><tr>';		for (var i=0; i<=(js_ids.length - 1); i++) {			out_string += '<td><a onclick="display(\'' + js_ids[i] + '\')"><img class="sample" src="/portfolio/thumbs/' + js_filenames[i] + '" alt="' + js_titles[i] + '" title="' + js_titles[i] + '" height="40px" /></a></td>';		}		out_string += '</tr></table>';		document.getElementById('samples').innerHTML = out_string;	}, 500);}function scroll_left() {	scroller = setInterval(function() {		temp_var = js_ids.pop();		js_ids.unshift(temp_var);		temp_var = js_filenames.pop();		js_filenames.unshift(temp_var);		temp_var = js_titles.pop();		js_titles.unshift(temp_var);		var out_string = '<table cellpadding="8px"><tr>';		for (var i=0; i<=(js_ids.length - 1); i++) {			out_string += '<td><a href="#" onclick="display(\'' + js_ids[i] + '\')"><img class="sample" src="/portfolio/thumbs/' + js_filenames[i] + '" alt="' + js_titles[i] + '" title="' + js_titles[i] + '" height="40px" /></a></td>';		}		out_string += '</tr></table>';		document.getElementById("samples").innerHTML = out_string;	}, 500);}//// SCROLLING VIDEOS//function scroll_left_v() {	scroller = setInterval(function() {		var temp_var = js_ids.shift();		js_ids.push(temp_var);		temp_var = js_thumbnames.shift();		js_thumbnames.push(temp_var);		temp_var = js_filenames.shift();		js_filenames.push(temp_var);		temp_var = js_titles.shift();		js_titles.push(temp_var);		var out_string = '<table cellpadding="8px"><tr>';		for (var i=0; i<=(js_ids.length - 1); i++) {			out_string += '<td><a onclick="display_video(\'' + js_ids[i] + '\')"><img class="sample" src="/portfolio/video_thumbs/' + js_thumbnames[i] + '" alt="' + js_titles[i] + '" title="' + js_titles[i] + '" height="40px" /></a></td>';		}		out_string += '</tr></table>';		document.getElementById('samples').innerHTML = out_string;	}, 500);}function scroll_right_v() {	scroller = setInterval(function() {		temp_var = js_ids.pop();		js_ids.unshift(temp_var);		temp_var = js_filenames.pop();		js_filenames.unshift(temp_var);		temp_var = js_titles.pop();		js_titles.unshift(temp_var);		var out_string = '<table cellpadding="8px"><tr>';		for (var i=0; i<=(js_ids.length - 1); i++) {			out_string += '<td><a onclick="display_video(\'' + js_ids[i] + '\')"><img class="sample" src="/portfolio/video_thumbs/' + js_filenames[i] + '" alt="' + js_titles[i] + '" title="' + js_titles[i] + '" height="40px" /></a></td>';		}		out_string += '</tr></table>';		document.getElementById("samples").innerHTML = out_string;	}, 500);}//// DISPLAY PHOTOGRAPH//function display(id) {	//alert(navigator.appName);	fadeOut();	if ((typeof(jfadeouttimer)!="undefined") && (jfadeouttimer != null)) {		//alert("pausedisplaytimer");		pausedisplaytimer = setTimeout("display(" + id + ")", 100);	} else {		if ((typeof(pausedisplaytimer)!="undefined") && (pausedisplaytimer != null)) {			clearTimeout(pausedisplaytimer);			pausedisplaytimer = null;		}		if (!id) id = window.event; // fix for IE		var imgArray = document.images;		var thumbIds = "";		for (var t=0; t<imgArray.length; t++) {			if (imgArray[t].name.substring(0,6) == 'thumb_') {				if (thumbIds == "") {					thumbIds = imgArray[t].name.substring(6);				} else {					thumbIds = thumbIds + "," + imgArray[t].name.substring(6);				}			}		}		var xhri = xhrRequest('html');		var qry = 'js=y&id=' + id + '&thumbIds=' + thumbIds;		var url = '/php/display_item.php';		xhr[xhri].open('POST', url, true);		xhr[xhri].onreadystatechange = function () {				if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {					document.getElementById('viewport').innerHTML = xhr[xhri].responseText;					xi[xhri] = 1;					xhr[xhri] = null;					if (slideshowstate == 1) {						hideImageInfo();					} else {						showImageInfo();					}					checkInfoGeometry();					var imgArray = document.images;					for (var t=0; t<imgArray.length; t++) {						//if ((imgArray[t].style.borderWidth == '1px') && (imgArray[t].style.borderStyle == 'solid') && (imgArray[t].style.borderColor == 'red')) {							imgArray[t].style.border = '1px none transparent';						//}						if (document.getElementById('thumb_'+id) != null) {							document.getElementById('thumb_'+id).style.border = '1px solid red';						}					}				} else {					try {						var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;						//alert(alertStr);					}					catch (e) {						var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";						//alert(alertStr);					}				}			};		xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		xhr[xhri].send(qry);	}}//// DISPLAY video//function display_video(id) {	if (!id) id = window.event; // fix for IE	var xhri = xhrRequest('html');	var qry = 'js=y&id=' + id;	var url = '/php/display_video.php';	xhr[xhri].open('POST', url, true);	xhr[xhri].onreadystatechange = function () {			if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {				document.getElementById('viewport').innerHTML = xhr[xhri].responseText;				xi[xhri] = 1;				xhr[xhri] = null;			} else {				try {					var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;					//alert(alertStr);				}				catch (e) {					var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";					//alert(alertStr);				}			}		};	xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xhr[xhri].send(qry);}function insert_movie() {	var thisElement = document.getElementById('this_video');	var vname = thisElement.name;	var vwidth = thisElement.width;	var vheight = thisElement.height;	document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="' + vwidth + '" height="' + vheight + '">');	document.write('<param name="src" value="portfolio/video/' + vname + '" />');	document.write('<param name="controller" value="true" />');	document.write('<param name="target" value="myself" />');	document.write('<param name="autoplay" value="false" />');	document.write('<!--[if !IE]>-->');	document.write('<object type="video/quicktime" data="/portfolio/video/' + vname + '" width="' + vwidth + '" height="' + vheight + '">');	document.write('<param name="autoplay" value="false" />');	document.write('<param name="target" value="myself" />');	document.write('<param name="controller" value="true" />');	document.write('</object>');	document.write('<!--<![endif]-->');	document.write('</object>');}//// MESSAGE VALIDATION//function validate_contact(form) {	if (!form) form = window.event; // fix for IE	var n_valid = false;	var e_valid = false;	var m_valid = false;	n_valid = validate_name(form.name);	e_valid = validate_email(form.email);	m_valid = validate_message(form.message);	if ((n_valid == false) || (e_valid == false) || (m_valid == false)) {		return false;	} else {		return true;	}}function validate_name(nameElement) {	if (!nameElement) nameElement = window.event; // fix for IE	if (nameElement.value == '') {		document.getElementById("name_error").style.visibility = "visible";		document.getElementById("name_error").style.display = "block";		nameElement.focus();		nameElement.select();		return false;	} else {		document.getElementById("name_error").style.visibility = "hidden";		document.getElementById("name_error").style.display = "none";		return true;	}}function validate_email(emailElement) {	if (!emailElement) emailElement = window.event; // fix for IE	if (emailElement.value == '') {		document.getElementById("email_error").style.visibility = "visible";		document.getElementById("email_error").style.display = "block";		document.getElementById("email_error").innerHTML = "Please enter your email address"		emailElement.focus();		emailElement.select();		return false;	} else {		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;		if(reg.test(emailElement.value) == false) {			document.getElementById("email_error").style.visibility = "visible";			document.getElementById("email_error").style.display = "block";			document.getElementById("email_error").innerHTML = "The email address you entered does not appear to be valid!"			emailElement.focus();			emailElement.select();			return false;		} else {			document.getElementById("email_error").style.visibility = "hidden";			document.getElementById("email_error").style.display = "none";			document.getElementById("email_error").innerHTML = ""			return true;		}	}}function validate_message(messageElement) {	if (!messageElement) messageElement = window.event; // fix for IE	if (messageElement.value == '') {		document.getElementById("message_error").style.visibility = "visible";		document.getElementById("message_error").style.display = "block";		messageElement.focus();		messageElement.select();		return false;	} else {		document.getElementById("message_error").style.visibility = "hidden";		document.getElementById("message_error").style.display = "none";		return true;	}}/*function showCategory() {	var newCat = document.getElementById('category_pulldown').options[document.getElementById('category_pulldown').selectedIndex].value;	var xhri = xhrRequest('html');	if (newCat == '') {		var qry = 'js=y&section=Portfolio';	} else {		var qry = 'js=y&section=Portfolio&category=' + newCat;	}	var url = '/parts/Portfolio.php';	xhr[xhri].open('POST', url, true);	xhr[xhri].onreadystatechange = function () {			if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {				document.getElementById('content').innerHTML = xhr[xhri].responseText;				xi[xhri] = 1;				xhr[xhri] = null;				xhri = xhrRequest('html');				url = '/parts/submenu.php';				xhr[xhri].open('POST', url, true);				xhr[xhri].onreadystatechange = function () {						if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {							document.getElementById('submenu').innerHTML = xhr[xhri].responseText;							xi[xhri] = 1;							xhr[xhri] = null;						} else {							try {								var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;								//alert(alertStr);							}							catch (e) {								var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";								//alert(alertStr);							}						}					};				xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');				xhr[xhri].send(qry);			} else {				try {					var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;					//alert(alertStr);				}				catch (e) {					var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";					//alert(alertStr);				}			}		};	xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xhr[xhri].send(qry);}*/function showCategory(newCat) {	//var newCat = document.getElementById('category_pulldown').options[document.getElementById('category_pulldown').selectedIndex].value;	stopSlideShow('noinfo');	var xhri = xhrRequest('html');	if (newCat == '') {		var qry = 'js=y&section=Portfolio';	} else {		var qry = 'js=y&section=Portfolio&category=' + newCat;	}	var url = '/parts/Portfolio.php';	xhr[xhri].open('POST', url, true);	xhr[xhri].onreadystatechange = function () {			if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {				document.getElementById('content').innerHTML = xhr[xhri].responseText;				if (newCat == "Choose gallery") {					document.getElementById('slideshowtoggle').style.visibility = 'visible';					document.getElementById('slideshowtoggle').style.display = 'block';					startSlideShow();				} else {					showImageInfo();				}				xi[xhri] = 1;				xhr[xhri] = null;				xhri = xhrRequest('html');				url = '/parts/submenu.php';				xhr[xhri].open('POST', url, true);				xhr[xhri].onreadystatechange = function () {						if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {							document.getElementById('submenu').innerHTML = xhr[xhri].responseText;							xi[xhri] = 1;							xhr[xhri] = null;						} else {							try {								var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;								//alert(alertStr);							}							catch (e) {								var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";								//alert(alertStr);							}						}					};				xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');				xhr[xhri].send(qry);			} else {				try {					var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;					//alert(alertStr);				}				catch (e) {					var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";					//alert(alertStr);				}			}		};	xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xhr[xhri].send(qry);}/*function showSubCategory() {	var newCat = document.getElementById('category_pulldown').options[document.getElementById('category_pulldown').selectedIndex].value;	var newSubCat = document.getElementById('subcategory_pulldown').options[document.getElementById('subcategory_pulldown').selectedIndex].value;	var xhri = xhrRequest('html');	if (newCat == '') {		var qry = 'js=y&section=Portfolio';	} else {		var qry = 'js=y&section=Portfolio&category=' + newCat + '&subcategory=' + newSubCat;	}	//alert(qry);	var url = '/parts/Portfolio.php';	xhr[xhri].open('POST', url, true);	xhr[xhri].onreadystatechange = function () {			if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {				document.getElementById('content').innerHTML = xhr[xhri].responseText;				xi[xhri] = 1;				xhr[xhri] = null;			} else {				try {					var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;					//alert(alertStr);				}				catch (e) {					var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";					//alert(alertStr);				}			}		};	xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xhr[xhri].send(qry);}*/function showSubCategory(catString) {	stopSlideShow('noinfo');	var catStringArray = catString.split('-');	var newCat = catStringArray[0];	var newSubCat = catStringArray[1];	var xhri = xhrRequest('html');	if (newCat == '') {		var qry = 'js=y&section=Portfolio';	} else {		var qry = 'js=y&section=Portfolio&category=' + newCat + '&subcategory=' + newSubCat;	}	//alert(qry);	var url = '/parts/Portfolio.php';	xhr[xhri].open('POST', url, true);	xhr[xhri].onreadystatechange = function () {			if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {				document.getElementById('content').innerHTML = xhr[xhri].responseText;				xi[xhri] = 1;				xhr[xhri] = null;				showImageInfo();			} else {				try {					var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;					//alert(alertStr);				}				catch (e) {					var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";					//alert(alertStr);				}			}		};	xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xhr[xhri].send(qry);}function checkCategory(thisId) {	var thisSelect = document.getElementById('category_'+thisId);	if (thisSelect.options[thisSelect.selectedIndex].value == '_new') {		var newCat = prompt("Enter a new category:","");		if (newCat!=null && newCat!="") {			var xhri = xhrRequest('html');			var qry = 'js=y&category='+newCat;			var url = '/php/validate_category.php';			xhr[xhri].open('POST', url, true);			xhr[xhri].onreadystatechange = function () {					if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {						var response = xhr[xhri].responseText;						if (response.search("ok") >= 0) {							var allSelects = document.getElementsByTagName('select');							for (var i=0; i<allSelects.length; i++) {								thisSelect = allSelects[i];								if (thisSelect.id.indexOf('category_') == 0) {									var newOption = document.createElement('option');									newOption.value = newCat;									newOption.text = newCat;									var newCatBefore = thisSelect.options[thisSelect.options.length - 1];									thisSelect.add(newOption,newCatBefore);									if (thisSelect.id == 'category_'+thisId) {										thisSelect.selectedIndex = thisSelect.options.length - 2;									}								}							}						} else if (response.search("exists") >= 0) {							//alert('That category ('+newCat+') already exists!');							for (var i=0; i<thisSelect.options.length; i++) {								if (thisSelect.options[i].value == newCat) {									var catIndex = i;								}							}							thisSelect.selectedIndex = catIndex;							thisSelect.options[catIndex].selected = true;						} else if (response.search("no") >= 0) {							alert('You entered an invalid category ('+newCat+')');							for (var i=0; i<thisSelect.options.length; i++) {								if (thisSelect.options[i].value == document.getElementById('prev_category_'+thisId).value) {									var prevIndex = i;								}							}							thisSelect.selectedIndex = prevIndex;							thisSelect.options[prevIndex].selected = true;						} else {							alert('unable to process response ('+response+')');						}						xi[xhri] = 1;						xhr[xhri] = null;					} else {						try {							var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;							//alert(alertStr);						}						catch (e) {							var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";							//alert(alertStr);						}					}				};			xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');			xhr[xhri].send(qry);		} else {			for (var i=0; i<thisSelect.options.length; i++) {				if (thisSelect.options[i].value == document.getElementById('prev_category_'+thisId).value) {					var prevIndex = i;				}			}			thisSelect.selectedIndex = prevIndex;			thisSelect.options[prevIndex].selected = true;		}	}}function checkSubCategory(thisId) {	var thisSelect = document.getElementById('subcategory_'+thisId);	if (thisSelect.options[thisSelect.selectedIndex].value == '_new') {		var newSubCat = prompt("Enter a new subcategory:","");		if (newSubCat!=null && newSubCat!="") {			var xhri = xhrRequest('html');			var qry = 'js=y&subcategory='+newSubCat;			var url = '/php/validate_subcategory.php';			xhr[xhri].open('POST', url, true);			xhr[xhri].onreadystatechange = function () {					if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {						var response = xhr[xhri].responseText;						if (response.search("ok") >= 0) {							var allSelects = document.getElementsByTagName('select');							for (var i=0; i<allSelects.length; i++) {								thisSelect = allSelects[i];								if (thisSelect.id.indexOf('subcategory_') == 0) {									var newOption = document.createElement('option');									newOption.value = newSubCat;									newOption.text = newSubCat;									var newSubCatBefore = thisSelect.options[thisSelect.options.length - 1];									thisSelect.add(newOption,newSubCatBefore);									if (thisSelect.id == 'subcategory_'+thisId) {										thisSelect.selectedIndex = thisSelect.options.length - 2;									}								}							}						} else if (response.search("exists") >= 0) {							//alert('That category ('+newCat+') already exists!');							for (var i=0; i<thisSelect.options.length; i++) {								if (thisSelect.options[i].value == newSubCat) {									var subCatIndex = i;								}							}							thisSelect.selectedIndex = subCatIndex;							thisSelect.options[subCatIndex].selected = true;						} else if (response.search("no") >= 0) {							alert('You entered an invalid category ('+newCat+')');							for (var i=0; i<thisSelect.options.length; i++) {								if (thisSelect.options[i].value == document.getElementById('prev_subcategory_'+thisId).value) {									var prevIndex = i;								}							}							thisSelect.selectedIndex = prevIndex;							thisSelect.options[prevIndex].selected = true;						} else {							alert('unable to process response ('+response+')');						}						xi[xhri] = 1;						xhr[xhri] = null;					} else {						try {							var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;							//alert(alertStr);						}						catch (e) {							var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";							//alert(alertStr);						}					}				};			xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');			xhr[xhri].send(qry);		} else {			for (var i=0; i<thisSelect.options.length; i++) {				if (thisSelect.options[i].value == document.getElementById('prev_subcategory_'+thisId).value) {					var prevIndex = i;				}			}			thisSelect.selectedIndex = prevIndex;			thisSelect.options[prevIndex].selected = true;		}	}}function onSetImageOptions(optForm) {	var imgForm = document.getElementById('list_images');	imgForm.optnumimages.value = optForm.optnumimages.options[optForm.optnumimages.selectedIndex].value;	imgForm.optsortby.value = optForm.optsortby.options[optForm.optsortby.selectedIndex].value;	imgForm.optcategory.value = optForm.optcategory.options[optForm.optcategory.selectedIndex].value;	imgForm.optsubcategory.value = optForm.optsubcategory.options[optForm.optsubcategory.selectedIndex].value;	imgForm.optsearch.value = optForm.optsearch.value;}function showKeywordSearch(keyword) {	var xhri = xhrRequest('html');	if (keyword == '') {		var qry = 'js=y&section=Portfolio';	} else {		var qry = 'js=y&section=Portfolio&keyword=' + keyword;	}	var url = '/parts/Portfolio.php';	xhr[xhri].open('POST', url, true);	xhr[xhri].onreadystatechange = function () {			if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {				document.getElementById('content').innerHTML = xhr[xhri].responseText;				xi[xhri] = 1;				xhr[xhri] = null;				showImageInfo();				/*				xhri = xhrRequest('html');				url = '/parts/submenu.php';				xhr[xhri].open('POST', url, true);				xhr[xhri].onreadystatechange = function () {						if (xhr[xhri].readyState == 4 && xhr[xhri].status == 200) {							document.getElementById('submenu').innerHTML = xhr[xhri].responseText;							xi[xhri] = 1;							xhr[xhri] = null;						} else {							try {								var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;								//alert(alertStr);							}							catch (e) {								var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";								//alert(alertStr);							}						}					};				xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');				xhr[xhri].send(qry);				*/			} else {				try {					var alertStr = "xhr[xhri].readyState=" + xhr[xhri].readyState + " xhr[xhri].status=" + xhr[xhri].status;					//alert(alertStr);				}				catch (e) {					var alertStr = "error getting xhr[xhri].readyState and xhr[xhri].status";					//alert(alertStr);				}			}		};	xhr[xhri].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	xhr[xhri].send(qry);}function fadeIn() {	if ((typeof(jfadeouttimer)!="undefined") && (jfadeouttimer != null)) {		jfadeintimer = setTimeout("fadeIn()",100);	} else {		//if (navigator.appName == 'Microsoft Internet Explorer') {			document.getElementById('viewport_img_loading').style.filter = 'alpha(opacity=0)';		//	var currentOpacity = (parseFloat(document.getElementById('viewport_img').style.filter))/100;		//} else {			document.getElementById('viewport_img_loading').style.opacity = 0;			var currentOpacity = parseFloat(document.getElementById('viewport_img').style.opacity);		//}		document.getElementById('viewport_img_loading').style.zIndex = 0;		if (currentOpacity < 1) {			var newOpacity = currentOpacity + opacityStep			if (newOpacity > 1) {				newOpacity = 1;			}			//if (navigator.appName == 'Microsoft Internet Explorer') {				document.getElementById('viewport_img').style.filter = 'alpha(opacity='+(newOpacity*100)+')';			//} else {				document.getElementById('viewport_img').style.opacity = newOpacity;			//}			jfadeintimer = setTimeout("fadeIn()",fadeInterval);		} else {			if ((typeof(jfadeintimer)!="undefined") && (jfadeintimer != null)) {				clearTimeout(jfadeintimer);				jfadeintimer = null;			}		}	}}function fadeOut() {	/*	if (navigator.appName == 'Microsoft Internet Explorer') {		alert(document.getElementById('viewport_img').filters.item('alpha'));		//var currentOpacity = (parseInt(document.getElementById('viewport_img').style.filter))/100;		if (typeof(document.getElementById('viewport_img').filters.alpha.opacity) != null) {			var currentOpacity = document.getElementById('viewport_img').filters.alpha.opacity;			alert(currentOpacity);		} else {			currentOpacity = 1;		}	} else {	*/		var currentOpacity = parseFloat(document.getElementById('viewport_img').style.opacity);	//}	if (currentOpacity > 0) {		var newOpacity = currentOpacity - opacityStep		//if (navigator.appName == 'Microsoft Internet Explorer') {			document.getElementById('viewport_img').style.filter = 'alpha(opacity='+(newOpacity*100)+')';		//} else {			document.getElementById('viewport_img').style.opacity = newOpacity;		//}		jfadeouttimer = setTimeout("fadeOut()",fadeInterval);	} else {		if ((typeof(jfadeouttimer)!="undefined") && (jfadeouttimer != null)) {			clearTimeout(jfadeouttimer);			jfadeouttimer = null;		}	}}function startSlideShow() {	if (numjsids > 1) {		slideshowstate = 1;		hideImageInfo();		//hideGalleryMenu();		//hideThumbnails();		document.getElementById('slideshowtoggle').innerHTML = "Stop slideshow";		if (curjsid >= numjsids) {			curjsid = 0;		}		if (tempImg[jsids[curjsid]].complete) {			display(jsids[curjsid]);			curjsid++;		//} else {		//	alert("image 'tempImg[" + jsids[curjsid] + "]' not finished loading");		}		jslideshow = setTimeout("startSlideShow()",sDelay);	} else {		slideshowstate = 0;		showImageInfo();		document.getElementById('slideshowtoggle').innerHTML = "";	}}function stopSlideShow(info) {	slideshowstate = 0;	if (jslideshow != null) clearTimeout(jslideshow);	jslideshow = null;	if (document.getElementById('slideshowtoggle') != null) {		document.getElementById('slideshowtoggle').innerHTML = "Start slideshow";	}	if (!info) showImageInfo();	//showGalleryMenu();	//showThumbnails();}function toggleSlideshow() {	if (slideshowstate == 1) {		stopSlideShow();	} else {		startSlideShow();	}}function resetSlideshowTimer() {	if (jslideshow != null) {		clearTimeout(jslideshow);		jslideshow = null;		jslideshow = setTimeout("startSlideShow()",sDelay);	}}function showImageInfo() {	//expand Info area	//document.getElementById('display_info').style.minHeight = '75px';	//show Title	document.getElementById('display_info_title').style.visibility = 'visible';	document.getElementById('display_info_title').style.display = 'block';	//show Keywords	document.getElementById('display_info_keywords').style.visibility = 'visible';	document.getElementById('display_info_keywords').style.display = 'block';	//show Caption	document.getElementById('display_info_caption').style.visibility = 'visible';	document.getElementById('display_info_caption').style.display = 'block';	//show Copyright	document.getElementById('display_info_copyright').style.visibility = 'visible';	document.getElementById('display_info_copyright').style.display = 'block';}function hideImageInfo() {	//hide Title	document.getElementById('display_info_title').style.visibility = 'hidden';	document.getElementById('display_info_title').style.display = 'none';	//hide Keywords	document.getElementById('display_info_keywords').style.visibility = 'hidden';	document.getElementById('display_info_keywords').style.display = 'none';	//hide Caption	document.getElementById('display_info_caption').style.visibility = 'hidden';	document.getElementById('display_info_caption').style.display = 'none';	//hide Copyright	document.getElementById('display_info_copyright').style.visibility = 'hidden';	document.getElementById('display_info_copyright').style.display = 'none';	//collapse Info area	//document.getElementById('display_info').style.minHeight = '50px';}function showGalleryMenu() {	document.getElementById('submenu').style.visibility = 'visible';	document.getElementById('submenu').style.display = 'block';}function hideGalleryMenu() {	document.getElementById('submenu').style.visibility = 'hidden';	document.getElementById('submenu').style.display = 'none';}function showThumbnails() {	document.getElementById('sampleport').style.visibility = 'visible';	document.getElementById('sampleport').style.display = 'block';	document.getElementById('pagenav').style.visibility = 'visible';	document.getElementById('pagenav').style.display = 'block';}function hideThumbnails() {	document.getElementById('sampleport').style.visibility = 'hidden';	document.getElementById('sampleport').style.display = 'none';	document.getElementById('pagenav').style.visibility = 'hidden';	document.getElementById('pagenav').style.display = 'none';}function checkInfoGeometry() {	var infoWidth = getComputedWidth('display_info');	var titleWidth = getComputedWidth('display_info_title');	var keywordsWidth = getComputedWidth('display_info_keywords');	var captionWidth = getComputedWidth('display_info_caption');	var copyrightWidth = getComputedWidth('display_info_copyright');	if ((titleWidth + keywordsWidth) > (infoWidth - 10)) {		while ((titleWidth + keywordsWidth) > (infoWidth - 10)) {			titleWidth--;			keywordsWidth--;		}		document.getElementById('display_info_title').style.width = titleWidth + 'px';		document.getElementById('display_info_keywords').style.width = keywordsWidth + 'px';	}	if ((captionWidth + copyrightWidth) > (infoWidth - 10)) {		while ((captionWidth + copyrightWidth) > (infoWidth - 10)) {			captionWidth--;			copyrightWidth--;		}		document.getElementById('display_info_caption').style.width = captionWidth + 'px';		document.getElementById('display_info_copyright').style.width = copyrightWidth + 'px';	}}function getComputedWidth(theElement){	if(navigator.userAgent.toLowerCase().indexOf("msie") != -1){		var theWidth = document.getElementById(theElement).offsetWidth;	} else {		var theWidth = parseInt(document.defaultView.getComputedStyle(document.getElementById(theElement), "").getPropertyValue("width"));	}	return theWidth;}function getComputedHeight(theElement){	if(navigator.userAgent.toLowerCase().indexOf("msie") != -1){		var theHeight = document.getElementById(theElement).offsetHeight;	} else {		var theHeight = parseInt(document.defaultView.getComputedStyle(document.getElementById(theElement), "").getPropertyValue("height"));	}	return theHeight;}// *********** MENU FUNCTIONS ***********var timeout         = 100;var closetimer		= 0;var ddmenuitem      = 0;// open hidden layerfunction mopen(id){		// cancel close timer	mcancelclosetime();	// close old layer	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';	// get new layer and show it	ddmenuitem = document.getElementById(id);	ddmenuitem.style.visibility = 'visible';}// close showed layerfunction mclose(){	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';}// go close timerfunction mclosetime(){	closetimer = window.setTimeout(mclose, timeout);}// cancel close timerfunction mcancelclosetime(){	if(closetimer)	{		window.clearTimeout(closetimer);		closetimer = null;	}}// close layer when click-outdocument.onclick = mclose; // *********** END OF MENU FUNCTIONS ***********
