function check_Redirect(){var X_URL = location.href;var doRedirect=false;if (X_URL.indexOf('%5F')>-1){X_URL=X_URL.replace(/%5F/gi,'_');doRedirect=true;}if (doRedirect==true){location.href = X_URL;}}
check_Redirect();

function hi(which){
	window.defaultStatus = document.getElementById('pic' + which + 'l').href;
	window.status = document.getElementById('pic' + which + 'l').href;
	document.getElementById('pic' + which + 'b').style.background='url(/images/arrow_on.gif) 100% 100% no-repeat';
}
function lo(which){
	window.status ='';
	window.defaultStatus ='';
	document.getElementById('pic' + which + 'b').style.background='url(/images/arrow.gif) 100% 100% no-repeat';
}
var clHold=false;
function cl(which){
	if (!clHold){location.href = document.getElementById('pic' + which + 'l').href;}
}

function btncng(theImage){
	var imgSrc=theImage.src;
	if (imgSrc.indexOf('_on')>-1)
	{
		imgSrc=imgSrc.substr(0,imgSrc.indexOf('_on'))+'_off.gif';
	} else 
	{
		imgSrc=imgSrc.substr(0,imgSrc.indexOf('_off.gif'))+'_on.gif';
	}
	theImage.src=imgSrc;
//	document[imgName].src=imgSrc;
}

function changeRPP(list){
	var url = location.href;
	var pos = -1;
	pos = url.indexOf('?rpp=');
//	alert(pos);
	if (pos>-1){
		url = url.substr(0,pos);
	}
	if (url.indexOf('?')>-1){
		//alert(url + '&rpp=' + list.options[list.selectedIndex].value);
		location.href=url + '&rpp=' + list.options[list.selectedIndex].value;
	} else {
		//alert(url + '?rpp=' + list.options[list.selectedIndex].value);
		location.href=url + '?rpp=' + list.options[list.selectedIndex].value;
	}
	
}
var objxmlhttp;
function getHTTPRequest(url,processRequest) 
{
	try{
		// branch for native XMLHttpRequest object
		if (window.XMLHttpRequest) {
			objxmlhttp = new XMLHttpRequest();
			if (processRequest){objxmlhttp.onreadystatechange = processHTTPRequest;}
			objxmlhttp.open("GET", url, true);
			objxmlhttp.send(null);
		} else if (window.ActiveXObject) {
			objxmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			if (objxmlhttp) {
				if (processRequest){objxmlhttp.onreadystatechange = processHTTPRequest;}
				objxmlhttp.open("GET", url, true);
				objxmlhttp.send();
			}
		}
	} catch(err){}
}

function processHTTPRequest() 
{
    // only if req shows "complete"
    if (objxmlhttp.readyState == 4) {
        // only if "OK"
        if (objxmlhttp.status == 200) {
			if (objxmlhttp.responseText.indexOf('getRelatedItems - ')>-1){
				processRelatedItems(objxmlhttp.responseText);
			}
//			alert(xmlhttp.responseText);
			
        } else {
			//error occurred
        }
    }
}

function processRelatedItems(result){if (result!=''){document.getElementById('relatedItems').innerHTML = result.replace('getRelatedItems - ','');}}


var arrayEmails=new Array();
	arrayEmails[0]=new Array();
	arrayEmails[0][0]='enquiries';
	arrayEmails[0][1]='minigalleryworld.com';
	
function email(thisLink,what,which)
{
	switch (which)
	{
		case 0:
			thisLink.href='mai' + 'lto:' + arrayEmails[what][0] + '@' + arrayEmails[what][1];
			return true;
			break;
		case 1:
			window.status='mai' + 'lto:' + arrayEmails[what][0] + '@' + arrayEmails[what][1];
			return true;
			break;
		case 2:
			window.status='';
			return true;
			break;
		case 3:
			return arrayEmails[what][0] + '@' + arrayEmails[what][1];
	}
}

function insertDate()
{
	dayName = new Array("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
	monName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
	now = new Date;

	var strDay;
	if ((now.getDate() == 1) || (now.getDate() != 11) && (now.getDate() % 10 == 1)) 		// Correction for 11th and 1st/21st/31st
		strDay = "st ";
	else if ((now.getDate() == 2) || (now.getDate() != 12) && (now.getDate() % 10 == 2)) 	// Correction for 12th and 2nd/22nd/32nd
		strDay = "nd ";
	else if ((now.getDate() == 3) || (now.getDate() != 13) && (now.getDate() % 10 == 3)) 	// Correction for 13th and 3rd/23rd/33rd
		strDay = "rd ";
	else
		strDay = "th ";
	document.write(dayName[now.getDay()] + ' ' + now.getDate() + strDay + monName[now.getMonth()] + ' ' + now.getFullYear());
}
function openNewWindow(theURL,winName,features){window.open(theURL,winName,features);}

function piccSearch(theImage){
	var imgSrc=theImage.src;
	var imgName=theImage.name;
	if (imgSrc.indexOf('_on')>-1) {
		imgSrc=imgSrc.replace('_on.gif','.gif');
	} else {
		imgSrc=imgSrc.replace('.gif','_on.gif');
	}
	document[imgName].src=imgSrc;
}
function gsc(tImg,which){if(which==1){tImg.className='gimgon';}else{tImg.className='gimgoff';}}