function pageIsLoading() {

		//alert('in loading');
    if (loadingCounter < 3)
	   {
//	   	if (loadingObject == 0)
//	   		{ loadingObject 	= findObject("loading",1);
//			  loadingGifObject  =  findObject("loadingGif",1);};
			  
//	   		{loadingObject 	= findObject("itemTitle",1);
//			  loadingGifObject  =  findObject("itemType",1);};

	    loadingCounter = loadingCounter + 1;			  
		if(loadingObject.visibility=="hidden")
	 		  {//alert('ready to show');
			   loadingObject.visibility="visible";
			   loadingGifObject.visibility="visible";}
		else 
			  {//alert('ready to hide');
			   loadingObject.visibility="hidden";
			   loadingGifObject.visibility="hidden";}
		}
	else
	   stopLoading();

	};
	
function startLoading() {

    //alert(loadingReference);
    if (loadingReference !== 0) 
	   {stopLoading();}
	//alert('first test');    
	loadingReference = setInterval("pageIsLoading()",500);
	loadingCounter = loadingCounter + 1;
	//alert('end test');    
    };

function stopLoading() {
    //alert('ready to stop');
    window.clearInterval(loadingReference);
	loadingReference = 0;
	loadingObject.visibility="hidden";
	loadingGifObject.visibility="hidden";
	loadingCounter = 0;
	//alert('finished to stop');
   };
   
function hideLoading() {
    //alert('ready to stop');
	loadingReference = 0;
	loadingObject.visibility="hidden";
	loadingGifObject.visibility="hidden";
	loadingCounter = 0;
	//alert('finished to stop');
   };
   
/*========================================================================
Routines to control the right mouse button - This doesnt work for Firefox
=========================================================================== */
/*

function right(e) {
//alert('jim');
if (whichBrs() == 'Firefox' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
mess = 'Copyright \251'+'2008 - WWW.GIGURTSIS.COM';
alert(mess);
return false;
}
return true;
};

/*
function right(e) {
mess = 'Copyright \251'+'2008 - WWW.GIGURTSIS.COM';
alert(mess);
return false;
};


document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
*/

/*========================================================================
Routines on loading the first page
=========================================================================== */


function init()
 {  MM_preloadImages('./images/PageImages/Img-FrontPage1.jpg',
 			     	'./images/PageImages/Img-FrontPage2.jpg');
//	setScrollBarColours();
//	alert('jim');
	//setUpHelpInfo();

	retrieveCookie();
	check_values();
 };

function init1()
 {  MM_preloadImages('../../images/PageImages/Img-FrontPage1.jpg',
 			     	'../../images/PageImages/Img-FrontPage2.jpg');
	setUpHelpInfo();
//	setScrollBarColours();
//	alert('jim');

 };
 
/*========================================================================
Routines to highlight an ion and also difuse the icon using a filter
=========================================================================== */
ns4 = (document.layers)? true:false
ns4b = (document.layers)? true:false
ie4 = (document.all)? true:false
ie4b = (document.all)? true:false
 
function hideIt(box){
var tbl = document.getElementById(box);
    tbl.style.visibility = "hidden";
};

function highlighting(theimgbg,thecolor){
document.getElementById(theimgbg).style.backgroundColor=thecolor;
};


function overIt() {
//  alert('over');
  if(ie4b){ 
		window.event.srcElement.style.filter = "alpha(opacity=70)"; 
	    }
};
function out() {
//   alert('out');
    if(ie4b){  window.event.srcElement.style.filter = "alpha(opacity=100)"; }
};


/*========================================================================
Routines to reload images 
=========================================================================== */
// Browser Detection Javascript
// copyright 1 February 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

function whichBrs() {
var agt=navigator.userAgent.toLowerCase();
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("webtv") != -1) return 'WebTV';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("phoenix") != -1) return 'Phoenix';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
if (agt.indexOf('\/') != -1) {
if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
return navigator.userAgent.substr(0,agt.indexOf('\/'));}
else return 'Netscape';} else if (agt.indexOf(' ') != -1)
return navigator.userAgent.substr(0,agt.indexOf(' '));
else return navigator.userAgent;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
};

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_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  //alert("jim");
  for (i=0; i<(args.length-1); i+=2) 
   { 
 //{ alert(args[i]+".location='"+args[i+1]+"'"); 
	eval(args[i]+".location='"+args[i+1]+"'"); };
};

/*========================================================================
Function to send an email
=========================================================================== */

function sendMessage(addressPart1)
 {var part1 = addressPart1+'@';
  var part2 = 'gigurtsis';
  var part3 = 'mailto:';
  var s_mal = part1+part2;
  document.location =part3+s_mal+".com";
 };
/*========================================================================
similarColour	 	 used to search for items of similar colour
similarProducts 	 used to search for items of similar type
=========================================================================== */
function showCollection() {
	document.productQuery1.reset();
	var collectionID;
	collectionID = tableData[currentIndex][14];
	document.productQuery1.collection.value = collectionID;
	document.productQuery1.queryType.value = 2;
	document.productQuery1.subjectType.value = 0;
 	document.productQuery1.productType.value = 0;
  	document.productQuery1.mediumType.value = 0;
	document.productQuery1.pageToDisplay.value = -1;
	document.productQuery1.priceDisplay.value = priceDisplay;
	document.productQuery1.submit();
	};
	
function similarColours() {
 	document.productQuery1.reset();
//	window.parent.leftFrame.startLoading();
	document.productQuery1.queryType.value = 2;
 	var colourNo;
	var productNo;
 	productNo = tableData[currentIndex][7];
 	subjectTypeNo = tableData[currentIndex][9];
 	document.productQuery1.subjectType.value = subjectTypeNo;
 	document.productQuery1.productType.value = productNo;
  	document.productQuery1.mediumType.value = 0;
  	document.productQuery1.pageToDisplay.value = -1;
	document.productQuery1.priceDisplay.value = priceDisplay;
 	document.productQuery1.submit();
 };
 
function similarProducts() {
 	document.productQuery1.reset();
//	window.parent.leftFrame.startLoading();
	document.productQuery1.queryType.value = 2;
 	var productNo;
	var mediumNo;
 	productNo = tableData[currentIndex][7];
	mediumNo = tableData[currentIndex][10];
 	document.productQuery1.productType.value = productNo;
   	document.productQuery1.mediumType.value = mediumNo;
	document.productQuery1.subjectType.value = 0;
 	document.productQuery1.pageToDisplay.value = -1;
	document.productQuery1.priceDisplay.value = priceDisplay;
 	document.productQuery1.submit();
 };
 
/*========================================================================
displayAPage	 	 used to navigate to a specific page
displayNextPage  	 used to display next page
displayPreviousPage  used to display previous page. If you are dealing
					 with Netscape browser then display a specific page
					 otherwise go back in history
=========================================================================== */
function displayAPage(aPageNo) {
        
		document.productQuery1.reset();
		//alert(incStep);
		document.productQuery1.pageToDisplay.value = aPageNo;
		document.productQuery1.incStep.value 		= incStep;
	 	document.productQuery1.userCcy.value 		= userCcy; 
	 	document.productQuery1.productDimensions.value = productDimensions;
	 	document.productQuery1.priceDisplay.value = priceDisplay;
	 	document.productQuery1.artist.value = artist;
		document.productQuery1.submit() ;
};
function displayPage() {
		anObject = findObject("selectList",0);
		aValue = anObject.value;
		displayAPage(aValue);
};

function displayNextPage() {
		anObject = findObject("selectList",0);
		aValue = anObject.value;
		aValue = parseInt(aValue) + 1;
		displayAPage(aValue);
};

function displayPreviousPage() {
		anObject = findObject("selectList",0);
		aValue = anObject.value;
		aValue = parseInt(aValue) -1;
		displayAPage(aValue);
	 };

/*========================================================================
Used to control the opening / closing of the personalisation page
when you are displaying a set of products.
personalise	 	 	is called when you slect the tools icon
openPersonalise		opens the personalisation layer
hidePersonalise		hides the Layer
=========================================================================== */

function personalise(xPos,yPos)
 { if (pageHasFinished)
      { openPersonalise(xPos,yPos);
	  };
 };
 
 function openPersonalise(xPos,yPos)
  {var temp = findObject("personalise",1);
  //alert(xPos);
  //alert(yPos);
  if (temp.visibility == 'visible')
      temp.visibility = 'hidden'
   else
      {	temp.left = xPos + "px",
   		temp.top  = yPos + "px";
		document.configForm.incStep.value = parseInt(document.productQuery1.incStep.value);
 		document.configForm.productDim.value = document.productQuery1.productDimensions.value;
		document.configForm.userCcy.value = document.productQuery1.userCcy.value;
		if (!cookiesAreAllowed())
	  		{anObject = findObject("cookiesOption",1);
	    	  anObject.display = "none";
			  
	  		};
		temp.zIndex = 1;
   		temp.visibility = 'visible'; };
  };
   
  function hidePersonalise()
 {var temp = findObject("personalise",1);
   temp.visibility = 'hidden';
  }; 
  
function selectCurrentOptions()
{	document.configForm.incStep.value = incStep;
 	document.configForm.productDim.value = productDimensions;
	document.configForm.userCcy.value = userCcy;
};

/*========================================================================
Used to control the configuration setting of the personalisation page
displayProductsUsingSettings()	is called when you select options on the 
								product personalisation page
displayProductsUsingDefaults()	is called when you select the default options  
								on the product personalisation page
setPersonalisationDefaults()	is called when you select the defaults in
								the personalisation page
setPersonalisationOptions()		is called when you select options on the 
								personalisation page								
=========================================================================== */

 function displayProductsUsingSettings()
  {
   var newStep = parseInt(document.configForm.incStep.value) ;
   var newDim  = document.configForm.productDim.value;
   var newCcy  = document.configForm.userCcy.value;
   
   //alert(newStep);
   if (document.configForm.saveDataCheckBox.checked)
     		{setCookie('clientOptions',newStep+'|'+newCcy+'|'+newDim,false);
			 document.productQuery1.saveData.value = '1'}
   else
     		{document.productQuery1.saveData.value = '0'};    
	
   document.productQuery1.incStep.value 				= newStep;
   document.productQuery1.userCcy.value 				= newCcy;
   document.productQuery1.productDimensions.value 	= newDim; 
   document.productQuery1.pageToDisplay.value 		= -1;
   setConfigValues(newStep,newCcy,newDim);
   //alert(document.productQuery1.incStep.value );
   document.productQuery1.submit();
   };
 
 //The curency should be EUR if we are displaying more than one currency  
function displayProductsUsingDefaults()
  {
	
   document.productQuery1.incStep.value 				= 9;
   document.productQuery1.userCcy.value 				= 'GBP';
   document.productQuery1.productDimensions.value 	= 0; 
   document.productQuery1.saveData.value 			= 0;  
   document.productQuery1.pageToDisplay.value 		= -1;
   setConfigValues(9,'GBP',0);
   //alert('ready');
    deleteCookie('clientOptions');
   document.productQuery1.submit();
   };
   
function setPersonalisationDefaults()
  {
   document.configForm.incStep.value = 9;
   document.configForm.userCcy.value = 'GBP';
   document.configForm.productDim.value = 0; 
   document.configForm.saveData.value = 0; 
   setConfigValues(9,'GBP',0);
     if (document.configForm.saveDataCheckBox.checked)
		 {setCookie('clientOptions',9+'|'+'GBP'+'|'+0,false);
		  document.configForm.saveData.value = '1'}
	  else
		 {document.configForm.saveData.value = '0'}; 
   var temp;
   temp = "./displayWebPage.asp";
   document.configForm.priceDisplay.value = priceDisplay;
   document.configForm.artist.value = artist;
   document.configForm.webPage.value = 'acknPersonalise';
   document.configForm.action = temp;

   document.configForm.submit();  
   };
   
 function setPersonalisationOptions()
  {
	  newStep = parseInt(document.configForm.incStep.value) ;
	  //alert(newStep);
	  newCcy  = document.configForm.userCcy.value;
	  newDim  = document.configForm.productDim.value; 
	  if (document.configForm.saveDataCheckBox.checked)
		 {setCookie('clientOptions',newStep+'|'+newCcy+'|'+newDim,false);
		  document.configForm.saveData.value = '1'}
	  else
		 {document.configForm.saveData.value = '0'}; 
	    
      setConfigValues(newStep,newCcy,newDim);
      //alert('done options');
  	  var temp;
	 temp = "./displayWebPage.asp";
	  document.configForm.priceDisplay.value = priceDisplay;
	  document.configForm.artist.value = artist;
	  document.configForm.webPage.value = 'acknPersonalise';
	  document.configForm.action = temp;
	  //  alert('ready');
      document.configForm.submit();  
   };


function setConfigValues(newStep,newCcy,newDim) {
     //alert('configValues');
	 //alert(newStep);
	 //alert(newCcy);
     incStep  			 = newStep;
	 userCcy  			 = newCcy;
	 productDimensions   = newDim;
	 };

function check_values() {
 if ( (typeof(userCcy) == "undefined") || (typeof(incStep) == "undefined") || (typeof(productDimensions) == "undefined"))
     setConfigValues(9,'GBP',0);
	};

/*========================================================================
displayProduct  is used to display a product
displaySubType  is used to displa a sub product
getCookieFlag   is ised to return the value of the cookie flag which is set 
  				by the leftFrame on startup
=========================================================================== */

function displayNewItems()
 {
	document.productQuery.collection.value = -1;
	document.productQuery.queryType.value = 2;
	document.productQuery.subjectType.value = 0;
 	document.productQuery.productType.value = 0;
  	document.productQuery.mediumType.value = 0;
	document.productQuery.pageToDisplay.value = -1;
	document.productQuery.priceDisplay.value = priceDisplay;
	document.productQuery.submit();
	};
	
 function displayProduct(aType)
   { 
     //alert('in product');
     document.productQuery.productType.value = aType;
   	 document.productQuery.mediumType.value = 0;
	 document.productQuery.incStep.value 		= incStep;
	 document.productQuery.userCcy.value 		= userCcy; 
	 document.productQuery.productDimensions.value = productDimensions;
	 document.productQuery.priceDisplay.value = priceDisplay;
	 document.productQuery.artist.value = artist;
	 document.productQuery.submit();
   };

function displaySubType(aType,aSubType)
   { 
     document.productQuery.productType.value = aType;
     document.productQuery.mediumType.value = aSubType;
	 document.productQuery.incStep.value 		= incStep;
	 document.productQuery.userCcy.value 		= userCcy;	 
	 document.productQuery.productDimensions.value = productDimensions;
	 document.productQuery.priceDisplay.value = priceDisplay;
	 document.productQuery.artist.value = artist;
	 //alert(userCcy);
	 //alert(productDimensions);
	 //alert('ready');
	 document.productQuery.submit();
   };
   
 function displaySitePage(aPage,controlPath)
   { 
	 document.productQuery.incStep.value 		= incStep;
	 document.productQuery.userCcy.value 		= userCcy; 
	 document.productQuery.productDimensions.value = productDimensions;
	 document.productQuery.priceDisplay.value = priceDisplay;
	 document.productQuery.artist.value = artist;
	 document.productQuery.webPage.value = aPage;
	 //alert(document.productQuery.webPage.value);
	 var temp;
	 temp = controlPath + "/displayWebPage.asp";
	 //alert('web page -'+aPage+' control page location - ' + temp);
	 document.productQuery.action = temp;

//	 document.productQuery.action = "./asp/aspWebControlPages/displayWebPage.asp";
	 //alert(document.productQuery.action);
	 document.productQuery.submit();
   };


 function displaySearchPage(aPage, controlPath)
   { 
	 document.productQuery.incStep.value 		= incStep;
	 document.productQuery.userCcy.value 		= userCcy; 
	 document.productQuery.productDimensions.value = productDimensions;
	 document.productQuery.priceDisplay.value = priceDisplay;
	 document.productQuery.artist.value = artist;
	 document.productQuery.webPage.value = aPage;
	 var temp;
	 temp = controlPath + "/displaySearchPage.asp";
	 document.productQuery.action = temp;
	 //alert(temp);
	 document.productQuery.submit();
   };

/*========================================================================
checkForm			used to check the validity of the search form
listChanged 		is used to check whether the selection is valid and to 
					enable the submit button
=========================================================================== */

function checkForm() {

  if ( dimensionsIsOkay())
     {
		return true; //should be true;
	  }
  else
      return false;
 };
 
 function dimensionsIsOkay() {
   var width 	= document.searchForm.width.value
   var height   = document.searchForm.height.value
   
   	if (width =='')
        width = 0
   	else 
   		width = parseInt(width);
		
   	if (height =='')
        height = 0
   	else 
   		height = parseInt(height);

 	if ((width < 0) || (height < 0)  )
       	{alert('Dimensions must be greater than zero (0).');
        	return false};	 
 		  
   document.searchForm.width.value = width;
   document.searchForm.height.value = height;   
 
   return true;
 };
      
	
  
  function listChanged(anObject) {
//  alert(anObject.value);
   var product 	= document.searchForm.mediumType.value;
   //alert(product);
   var colour  		= document.searchForm.subjectType.value;
   var width 		= document.searchForm.width.value;
   var height   	= document.searchForm.height.value;
   var year			= document.searchForm.year.value;
   var art      	= document.searchForm.productType.value;
   var collection   = document.searchForm.collection.value;	
   //alert(art);
   anObject = findObject("mediumType",0);
   anObject1 = findObject("collection",0);
   
   if (art == 20) 
      {document.searchForm.mediumType.value ="0";
	   anObject.disabled = true;
	   anObject1.disabled = false;
	   product = 0;
	   }
   else
      {document.searchForm.collection.value ="0";
	   anObject.disabled = false;
	   anObject1.disabled = true;
	   colection = 0;
       };
	  
  // to reset the form  document.searchForm.reset();
	  
  if ((product > 0 ) || (colour > 0)  || (collection > 0) || (width > 0) ||  (height > 0) ||  (year > 0))
      document.searchForm.Submit.disabled = false;
  else
      document.searchForm.Submit.disabled = true;   
  };
  
  
/*========================================================================
findObject 			find an object reference wither withStyle (1) or without (0)
isBrowserNetscape 	test to see if the browser is Netscape

=========================================================================== */

function findObject(objectID,withStyle) {


var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;

if (document.getElementById) 
          {isID = 1; isDHTML = 1;}
     else {if (document.all) {isAll = 1; isDHTML = 1;}
             else {browserVersion = parseInt(navigator.appVersion);
                   if((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) 
                        {isLayers = 1; isDHTML = 1;}
                  }
          };

 if (withStyle == 1) 
	{if (isID) { return(document.getElementById(objectID).style) ; }		
            else { if (isAll) { return (document.all[objectID].style); }	
                       else {if (isLayers) { return (document.layers[objectID]); }};
                 }
        }
	
    else {if (isID) { return (document.getElementById(objectID)) ; }		
             else {if (isAll) { return (document.all[objectID]); }		
                       else {if (isLayers) { return (document.layers[objectID]); }};
          }
     }
};

function isBrowserNetscape() 
	{
	 var nav = navigator.appName.indexOf("Netscape");
	 return nav;
	};

/*========================================================================
displayProduct  is used to display a product
displaySubType  is used to displa a sub product
getCookieFlag   is ised to return the value of the cookie flag which is set 
  				by the leftFrame on startup
=========================================================================== */

 function printProduct()
   { 
     /*window.parent.leftFrame.startLoading(); */
    
	 var winl = 665;
	 var wint = 570;  //570
     winprops = 'height='+wint+',width='+winl+',top='+0+',left='+0+',scrollbars='+'yes'+',resizable='+'yes'+',menubar='+'yes';
	 win = window.open("", "PrintView", winprops);
	 
     document.productQuery.action = "../asp/processPrintRequest.asp";
	 document.productQuery.target = "PrintView";

	 aType    = tableData[currentIndex][4];
	 aSubType = tableData[currentIndex][7];
	 aColour  = tableData[currentIndex][6];
//	 alert(aType+' | '+aSubType+' | '+aColour);
	 document.productQuery.queryType.value = 2;
     document.productQuery.productType.value = aType;
   	 document.productQuery.mediumType.value = aSubType;
	 document.productQuery.subjectType.value = aColour;
	 document.productQuery.incStep.value 		= window.parent.incStep
	 document.productQuery.userCcy.value 		= window.parent.userCcy	 
	 document.productQuery.productDimensions.value = window.parent.productDimensions
//	 alert(document.productQuery.action);
//	 alert(document.productQuery.target);
	 document.productQuery.submit();
	 document.productQuery.action = "../asp/processUserSearch.asp";
	 document.productQuery.target = "mainFrame";
//	 window.parent.leftFrame.stopLoading();
   };
   
   function printProduct1(aType)
   { 
//	window.parent.leftFrame.startLoading();
    
	 var winl = 665;
	 var wint = 570;  //570
     winprops = 'height='+wint+',width='+winl+',top='+0+',left='+0+',scrollbars='+'yes'+',resizable='+'yes'+',menubar='+'yes';
	 win = window.open("", "PrintView", winprops);
	 
     document.productQuery.action = "../asp/processPrintRequest.asp";
	 document.productQuery.target = "PrintView";
	 alert(aType);
	 document.productQuery.queryType.value = 2;
     document.productQuery.productType.value = aType;
   	 document.productQuery.mediumType.value = 10;
	 document.productQuery.subjectType.value = 18;
	 document.productQuery.incStep.value 		= window.parent.incStep
	 document.productQuery.userCcy.value 		= window.parent.userCcy	 
	 document.productQuery.productDimensions.value = window.parent.productDimensions
//	 alert(document.productQuery.action);
//	 alert(document.productQuery.target);
	 document.productQuery.submit();
	 document.productQuery.action = "../asp/processUserSearch.asp";
	 document.productQuery.target = "mainFrame";
   };