window.status = "Welcome to Superior Custom Carpets Website";

function SetTargetSrc(_frame_, _source_)	
{ 
	//var theframe = window.parent.document.getElementById(_frame_); 
	var theframe = document.getElementById(_frame_); 
	if (theframe) 
		theframe.src = _source_; 
}

function OnMenuOver(obj) 
{
	obj.className = "menuover";
}

function OnMenuOut(obj) 
{
	obj.className = "menuitem";
}

function OnMenuClick(obj, _frame_, _source_) 
{
	SetTargetSrc(_frame_, _source_);
}

//*** GALLERY IMAGES
  var _imageIndex = 0;
  var _imageArray = new Array();
  var _sampleWidth = "120";
  var _sampleHeight = "120";

  function ImageObject(fname,ext,alt) {
    this.src = fname;
    this.ext = ext;
    this.alt = alt;
  }

  function AddImageObject(fname,ext,alt) 
  {
    _imageArray[_imageIndex++] = new ImageObject(fname,ext,alt);
  }


function ShowSample(_imgpath_) {
	var _win_ = window.open("../images/samples/" + _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 WriteImageCode(iindex) {
	var _imgename_ = _imageArray[iindex].src;
	var _imgext_ = _imageArray[iindex].ext;
	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: hand; FILTER: alpha(opacity=50)" onmouseout="nereidFade(this,50,50,5)" ');
	document.write(' onclick="javascript:ShowSample(\'' + _imgename_ + '_full' + _imgext_ + '\');" ');
	document.write(' alt="' + _alt_ + '" src="../images/samples/' + _imgename_ + _imgext_ + '" ' );
	// the end
	document.write(' >');	
}

function WriteImageSampleCode(iindex) 
{  
		// image cell
		document.write('<TD valign="top" width="' + _sampleWidth + '" class=border >');
//		document.write('<IMG alt="" src="../images/hanger.gif" class="imagehanger" >');
		WriteImageCode(iindex);
		document.write('</TD>');
}

function WriteImages() 
{
	document.write('<TABLE id="Table2" borderColor="#504010" cellSpacing="2" cellPadding="2" border="0" >');

	var needTROpen = true;
	var needTRClose = false;

	for(i=0; i < _imageIndex; i++) 
	{
		if(true == needTROpen) 
		{
			document.write('<TR>');
			needTROpen = false;
		}
		
		WriteImageSampleCode(i);

		needTRClose = (0 == ((i+1)%5));
		if(true == needTRClose) 
		{
			document.write('</TR>');
			needTROpen = true;
			needTRClose = false;
		}		
	}
		
	document.write('</TABLE>');
}
//*** END GALLERY IMAGES