window.status = "Welcome to Superior Custom Carpets Website";

function SetLocation(_source_)	
{ 
	window.location = _source_;
}


function OnMenuOver(obj) 
{
	obj.className = "menuover";
}

function OnMenuOut(obj) 
{
	obj.className = "menuitem";
}


//*** GALLERY IMAGES
  var _imageIndex = 0;
  var _imageArray = new Array();
  var _sampleWidth = "120";
  var _sampleHeight = "120";
  var _imagesFolder = "./images/samples/";

  function ImageObject(fname,ext,alt) 
	{
    this.src = fname;
    this.ext = ext;
    this.alt = alt;
		this.preview = fname + ext;
		this.full = fname + '_full' + ext;
  }

  function AddImageObject(fname,ext,alt) 
  {
    _imageArray[_imageIndex++] = new ImageObject(fname,ext,alt);
  }


  
function ShowSample(_imgpath_) 
{
	var _win_ = window.open(_imgpath_, null, "left=0, top=0, scrollbars=yes, status=yes, toolbar=no, menubar=no, location=no, titlebar=no, resizable=yes");
	if(null != _win_) {
		if( null != _win_.screen ) {
			_win_.resizeTo(screen.availWidth,screen.availHeight);
			_win_.moveTo(0,0);
		}
	}
}

function PreviewSample(source)
{
	var imgObj = document.getElementById("imgPreview");
	if(null != imgObj)
	{
		imgObj.src = source;
		imgObj.style.width = "600px";
		imgObj.style.height = "200px";
	}
}

function WriteImageCode(iindex) 
{
	var _preview_ = _imagesFolder + _imageArray[iindex].preview;
	var _full_ = _imagesFolder + _imageArray[iindex].full;
	var _alt_= _imageArray[iindex].alt;
	var _ctlname = '_img_' + iindex + '';
	document.write('<IMG name="' + _ctlname + '" width=' + _sampleWidth + ' height=' + _sampleHeight);
	document.write(' onmouseover="nereidFade(this,100,50,10)" style="CURSOR: pointer; FILTER: alpha(opacity=50)" onmouseout="nereidFade(this,50,50,5)" ');
	document.write(' onclick="javascript:PreviewSample(\'' + _full_ + '\');" ');
//	document.write(' onclick="javascript:ShowSample(\'' + _full_ + '\');" ');
	document.write(' alt="' + _alt_ + '" src="' + _preview_ + '" ' );
	// the end
	document.write(' >');	
}

function WriteImageSampleCode(iindex) 
{  
		// image cell
		document.write('<TD valign="top" width="' + _sampleWidth + '" class=border >');
		WriteImageCode(iindex);
		document.write('</TD>');
}


function WriteImages() 
{
	document.write('<TABLE id="Table2" borderColor="#504010" cellSpacing="2" cellPadding="2" border="0" >');
	document.write('<TR>');

	for(i=0; i < _imageIndex; i++) 
	{
		WriteImageSampleCode(i);
	}

	document.write('</TR>');		
	document.write('</TABLE>');
}
//*** END GALLERY IMAGES