var bolIntroShown = false;

function RemoveSearchMode()
{
	try {
		ActiveMerchandiser.catalogview.RemoveSearchMode();
		document.getElementById("imgClearSearch").style.visibility = "hidden";
		document.getElementById("txtPageNo").value = "";
	} 
	catch (e) {
	//	alert(e);
	}
}


function ShowCatalogGroup(GroupOID, width, height)
{
	var intWidth = screen.width;
	var strSubDir = "";
	var property = "top=0, left=0, resizable=1, width=" + (width - 20) + ", height=" + (height-20);
	var wincatalog = window.open("CG_Preview.aspx?GroupID=" + GroupOID, 'CatalogSearchAll', property);
	wincatalog.focus();

}

function sethotspot(dblRatio, Params)
{
	 try {
		window.document.getElementById("divLoading").innerHTML = "<br><i>Loading......</i>";
		window.document.getElementById("divLoading").style.visibility = "visible";
		ActiveMerchandiser.pagetemplatecatalogview.GenerateScriptForDrawingHotSpotsForThumbnail(dblRatio, Params, sethotspot_CallBack);
	} 
	catch (e) {
	//	alert(e);
	}
	 
}
//callback we told Ajax.Net to pass the response tos
function sethotspot_CallBack(response)
{
  if (response.error != null)
  {    
    return;
  }  
  
  
  var sethotspot = response.value; 
  
  //if the response wasn't what we expected  
  if (sethotspot == null)
  {
	
    return;  
  }
  
var strWindowSize = sethotspot.substring(0, sethotspot.indexOf('||'));
sethotspot = sethotspot.substring(sethotspot.indexOf('||') + 2);
	
 while (sethotspot.indexOf('||') != -1)
 {
	var strDrawHotSpots = sethotspot.substring(0, sethotspot.indexOf('||'));
	sethotspot = sethotspot.substring(sethotspot.indexOf('||') + 2);
	
	CallDrawHotSpots(strWindowSize, strDrawHotSpots);
  }	
 // alert(sethotspot);
  if (sethotspot != '') { CallDrawHotSpots(strWindowSize, sethotspot);   }
  window.document.getElementById("divLoading").innerHTML = "";
  window.document.getElementById("divLoading").style.visibility = "hidden";
}

function CallDrawHotSpots(strWindowSize, strDrawHotSpots)
{
var strDivName;
var hotspotcoordinates;
var NoOfPoints;
//alert(strDrawHotSpots);
	if (strDrawHotSpots.indexOf(';') != -1)
	{
		strDivName = strDrawHotSpots.substring(0, strDrawHotSpots.indexOf(';'));
		strDrawHotSpots = strDrawHotSpots.substring(strDrawHotSpots.indexOf(';') + 1);
	}
	
	if (strDrawHotSpots.indexOf(';') != -1)
	{
		hotspotcoordinates = strDrawHotSpots.substring(0, strDrawHotSpots.indexOf(';'));
		strDrawHotSpots = strDrawHotSpots.substring(strDrawHotSpots.indexOf(';') + 1);
	}
	
	NoOfPoints = parseInt(strDrawHotSpots);
    //alert(strDivName + " " + hotspotcoordinates + " " + NoOfPoints);
	DrawHotSpots(strWindowSize, strDivName, hotspotcoordinates, NoOfPoints);

}

//ImageName, HotSpotsCoordinates
function DrawHotSpots(WindowSize, divName, hotspotcoordinates, NoOfPoints)
{
   var jg = new jsGraphics(divName);            // initialize DIVs as 'canvases'
   jg.setColor('#666666');					  // alter pen color aa6666
   hotspotcoordinates = hotspotcoordinates.split(",");
   var intCount = 0
   var intX0;
   var intY0;
   var intX1;
   var intY1;
   var intXs = new Array()
   var intYs = new Array();
   
   var intXAdjust = 0;
   var intYAdjust = 0;
   
   var intXSize = 445;
   var intYSize = 576;
   
   if (divName == 'bindingright')
   {
     if (WindowSize == 'medium') 
     {  	intXAdjust = 485 - 5; 
			
     }
     if (WindowSize == 'small') 
     {  	
		intXAdjust = 445 * 0.75 + 50; 
		intXSize = intXSize * 0.75; 
	}
     if (WindowSize == 'large')
     {  	
		intXAdjust = 445 * 1.5 + 40;  
		intXSize = intXSize * 1.5;
	}
     //intYAdjust = 20;
   }
   else
   {
      if (divName == 'overall')
      {
        
		intXAdjust = 25;
		intYAdjust = 0;
		if (WindowSize == 'large')
		{
		    intXAdjust += 225;
		}
      }
      else if (divName == 'binding')
      {
		intXAdjust = 2;
		intYAdjust = 0;
      }
      else
      {
		intXAdjust = 0;
		intYAdjust = 0;
      }
   }
   
   var IsThumbnail = true;
   if ((divName == 'bindingright') || (divName == 'binding') || (divName == 'overall'))
   {
		IsThumbnail = false;
	}
	
	if (!IsThumbnail)
	{
		jg.setStroke(2);
	}
   
   while (intCount < NoOfPoints - 1)
   {
		intX0 = parseInt(hotspotcoordinates[intCount*2]) + intXAdjust;
		intY0 = parseInt(hotspotcoordinates[intCount*2 + 1]) + intYAdjust;
		intX1 = parseInt(hotspotcoordinates[intCount*2 + 2]) + intXAdjust;
		intY1 = parseInt(hotspotcoordinates[intCount*2 + 3]) + intYAdjust;
		intXs[intCount] = intX0;
		intYs[intCount] = intY0;
		jg.drawLine(intX0, intY0, intX1, intY1);
		intCount = intCount + 1;
   }
   
  intX0 = parseInt(hotspotcoordinates[intCount*2 + 0])+ intXAdjust;
  intY0 = parseInt(hotspotcoordinates[intCount*2 + 1]) + intYAdjust;
  intX1 = parseInt(hotspotcoordinates[0])+ intXAdjust;;
  intY1 = parseInt(hotspotcoordinates[1]) + intYAdjust;
  //alert(divName + " " + intX0 + " " + intY0 + " " +intX1 + " " + intY1);
  intXs[intCount] = intX0;
  intYs[intCount] = intY0;
  jg.drawLine(intX0, intY0, intX1, intY1);
  
  jg.setColor('#666666');			//ee9999
  //if (IsThumbnail)  {    	jg.fillPolygon(intXs, intYs);    }
  //jg.fillPolygon(intXs, intYs);  
  jg.paint(); 
}

function RegisterImageMapGenerator()
{
	var ImageObj = document.getElementById("ImgImageMap");
	ImageObj.onclick = ImgPageClick;
	if (ImageObj.captureEvents) ImageObj.captureEvents(Event.CLICK);

}
function ImageLinkClick(Index)
{
	
	document.getElementById("hidCommand").value = "LinkClick" + "-" + Index;
    document.TemplateForm.submit();
}

function ImgPageClick(e)
{
  var XPosition = -1;
  var YPosition = -1;
  if (!e)   e= window.event;
  var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
  var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1);
  if (isIE)
  {
	if (e.offsetX)
	{
		XPosition = e.offsetX;
		YPosition = e.offsetY;
	}
	else
	{
		alert("don't know how to get position out of event");
		return;
	}
  }
  else if (e.clientX || e.clientY)
  {
		XPosition = e.clientX;
		YPosition = e.clientY;
  }
  var ImgPositionX = 0;
  var ImgPositionY = 0;
  if (!isIE)
  {
	var ImageObj = document.getElementById("binding")
	//alert(ImageObj.offsetLeft)
	if (ImageObj.offsetLeft || ImageObj.offsetTop)
	{
		ImgPositionX = ImageObj.offsetLeft;
		ImgPositionY = ImageObj.offsetTop;
	}
  }
  var CoordinateX = XPosition - ImgPositionX;
  var CoordinateY = YPosition - ImgPositionY;
  document.getElementById("hidCoordicate").value= CoordinateX + ", " + CoordinateY;
  document.getElementById("hidCommand").value = "ImageClick";
  document.TemplateForm.submit();
}

function ShowHelp()
{
	var intWidth = screen.width;
	var width = 485;
	var height = 530;
	var strFileName = "Help.htm";
		
	var property = "top=0, left=0, scrollbars=yes, width=" + width + ", height=" + height;
	var strURL = strFileName;
	var winHelp = window.open(strURL, 'Help', property);
	winHelp.focus();
}

//function ShowTOC2(CatalogOID, subDir, width, height)
function ShowTOC2(CatalogOID, SupplierID, subDir)
{
	var intWidth = screen.width;
	var width = 970;
	var height = 656;
	if (intWidth > 1500)
	{
		width = 1415;
		height = 944;
	}
	
	if (intWidth < 1024)
	{
		width = 748;
		height = 512;
	}
	
	var strSubDir = "";
	if (subDir == true) 
	{	
		strSubDir = "../";
	}
	
	var property = "top=0, left=0, resizable=1, width=" + width + ", height=" + height;
	var strURL = strSubDir + "CatalogView.aspx?CatalogOID=" + CatalogOID + "&SupplierID=" + SupplierID + "&ShowPage=ViewCatalog.aspx?Left=1:amp:Right=-1:amp:CatalogOID=" + CatalogOID;
	var winCatalog = window.open(strURL, 'ActiveMerchandiser', property);
	
	winCatalog.focus();
}

// Mouseover related functions
function showleadgenerator(IsLeft, bolIsLastInMiddle)
{
	if (!bolIntroShown)
	{
		document.getElementById("divLeadGenerator").style.visibility = "visible";
		var classname; 
		if (bolIsLastInMiddle) 	{ 	classname = "LeadGeneratorLast"; 	}
		else
		{
			if (!IsLeft) { 		classname = "LeadGeneratorRight"; 		}
			else  { 	classname = "LeadGeneratorLeft"; 		}
		}
		
		document.getElementById("divLeadGenerator").className = classname;
	}
}



function gotoleadpage(PageNo, PageSize)
{
	
	var PageName  = "LeadPage.aspx"
	
	if (PageSize.toLowerCase() == "large")
	{
	    PageName = "LeadPageLarge.aspx"
	}
	if (PageSize.toLowerCase() == "small")
	{
	    PageName = "LeadPageSmall.aspx"
	}
	
	window.document.location.replace(PageName + "?PageNo=" + PageNo);
}

function hideleadgenerator()
{
	document.getElementById("divLeadGenerator").style.visibility = "hidden";
}


function showintro(linkto)
{
	//alert("here");
	if (document.getElementById("div" + linkto).innerHTML != "")
	{
		//alert(linkto);
		document.getElementById("div" + linkto).style.visibility = "visible";
		bolIntroShown = true;
		hideleadgenerator();
		//alert("Here");
	}
	if (document.getElementById(linkto) != null)
	{
	    //alert("here");
		document.getElementById(linkto).className = "MOBordered";
	}
}

function hideintro(linkto)
{
	//alert("here1");
	document.getElementById("div" + linkto).style.visibility = "hidden";
	bolIntroShown = false;
}
// Mouseover related functions

function ShowTOC(CatalogOID)
{
	ShowTOC2(CatalogOID, false);
}

function ShowContent(PageNumber, CatalogOID, Embedded) {
    var strEmbedded = "";
    if (Embedded == true) strEmbedded = "&Embedded=true";
    document.getElementById("iframeCatalog").src = "ViewCatalog.aspx?Left=" + PageNumber + "&Right=" + (PageNumber + 1) + "&CatalogOID=" + CatalogOID + strEmbedded + "&Rand=" + Math.random();
		document.getElementById("txtPageNo").value = "";
}


function showexternal(externalurl, eventlogurl)
{
	var property = "";
	
	if ((externalurl.indexOf('http://') == -1) && (externalurl.indexOf('https://') == -1))
	{
		externalurl = 'http://' + externalurl;
		
	}
	//alert(externalurl);
	var winExternalURL = window.open(externalurl, 'External', property);
	winExternalURL.focus();
	//alert(eventlogurl);
	window.document.location.replace(eventlogurl);
}



function showpagerefreshparent(PageNumber, CatalogOID, Password, bolEmbedded) {
    var strEmbedded = "";
    if (bolEmbedded == true) { strEmbedded = "&Embedded=true"; }
    var strURL = "ViewCatalog.aspx?Left=" + PageNumber + "&Right=" + (PageNumber + 1) + "&CatalogOID=" + CatalogOID + "&Password=" + Password +strEmbedded;
    window.document.location.replace(strURL);
}

function SetParentPreviousNext(PreviousLink, NextLink)
{
    //alert(PreviousLink + " " + NextLink);
	window.parent.document.getElementById("hidPrevious").value = PreviousLink;
	window.parent.document.getElementById("hidNext").value = NextLink;
	
}
function GoPrevious()
{
	GoPage('Previous');
}

function GoNext()
{
	GoPage('Next');

}

function GoPage(PreviousNext)
{
  var strIFrameSrc = '';
  var strCssClass = '';
  
  var objHid = window.document.getElementById("hid" + PreviousNext);
  
  if (objHid != null)
  {


      if (objHid.value.substring(0, 1) == "?") 
      {
       objHid.value = "viewcatalog.aspx" + objHid.value;
      }
	strIFrameSrc = objHid.value.substring(0, objHid.value.indexOf('::'));
	strCssClass = objHid.value.substring(objHid.value.indexOf('::') + 2);

	 document.getElementById("iframeCatalog").src = strIFrameSrc + "&Rand=" + Math.random();
	 if (strCssClass != "")
	 { document.getElementById("iframeCatalog").className = strCssClass; }
  }
}

// Mouseover related functions
function setalt(LinkToList)
{
    try {
        if (LinkToList != null)
        { ActiveMerchandiser.pagetemplatecatalogview.GetAlt(LinkToList, setalt_CallBack); }
	}
	catch (e) { alert(e); }           
	 
}
//callback we told Ajax.Net to pass the response tos
function setalt_CallBack(response)
{
  //if the server side code threw an exception
  if (response.error != null)
  {    
    //alert(response.error); //we should probably do better than this
    return;
  }  
  
  var stralt = response.value; 
          //if the response wasn't what we expected  
  if (stralt == null)
  {
    return;  
  }
	
 	//alert(stralt);
 while (stralt.indexOf('|') != -1)
 {
	var strMouseOverContent = stralt.substring(0, stralt.indexOf('||'));
	stralt = stralt.substring(stralt.indexOf('||') + 2);
	//alert(strMouseOverContent);

	PopulateDiv(strMouseOverContent);
  }	
 // alert(stralt);
  if (stralt != '') { PopulateDiv(stralt);   }
	
}

function PopulateDiv(strMouseOverContent)
{
    var strlinkto = strMouseOverContent.substring(0,strMouseOverContent.indexOf('::')); 
	//alert(strlinkto);
	strMouseOverContent = strMouseOverContent.substring(strMouseOverContent.indexOf('::') + 2);
	var strlinkto2 = strlinkto.replace("/", "_");
	var strlinkto3 = strlinkto2.replace(" ", "_SPACE_");
	var strlinkto4 = strlinkto3.replace(" ", "_SPACE_");    // some sku contains more than one spaces
	strlinkto4 = strlinkto4.toLowerCase();
	//alert(strlinkto4);
	var lbl = document.getElementById("div" + strlinkto4);
	if (lbl != null) 	{ 		lbl.innerHTML = strMouseOverContent;  	}
	for(i = 1; i < 20; i++){				// the largest number of duplicates need to be less than 10
		lbl = document.getElementById("div" + strlinkto4 + "__" + i);
		if (lbl != null) 	{ 		lbl.innerHTML = strMouseOverContent;  	}
	}
}

//setalthotURL
function setaltCustom(LinkToList)
{
		//alert(LinkToList);
		ActiveMerchandiser.pagetemplatecatalogview.GetAltCustom(LinkToList, setaltCustom_CallBack);
}
//callback we told Ajax.Net to pass the response tos
function setaltCustom_CallBack(response)
{
  //if the server side code threw an exception
  if (response.error != null)
  {    
    return;
  }  
  
  var stralt = response.value; 

  if (stralt == null)
  {
	return;  
  }
	
 while (stralt.indexOf('|') != -1)
 {
	var strMouseOverContent = stralt.substring(0, stralt.indexOf('||'));
	stralt = stralt.substring(stralt.indexOf('||') + 2);
	//alert(strMouseOverContent);
	PopulateDivCustom(strMouseOverContent);
  }	
  //alert(stralt);
  if (stralt != '') { PopulateDivCustom(stralt);   }
}

function PopulateDivCustom(strMouseOverContent)
{
    var strlinkto = strMouseOverContent.substring(0,strMouseOverContent.indexOf('::')); 
	//alert(strlinkto);
	strMouseOverContent = strMouseOverContent.substring(strMouseOverContent.indexOf('::') + 2);
	var lbl = document.getElementById("divCustom" + strlinkto);

	if (lbl != null) 	{ 		lbl.innerHTML = strMouseOverContent;  	}
}


function CheckSKUs(SKUList, SKUOIDList)
{
		//alert(SKUList);
		ActiveMerchandiser.CV_CoordinatesAndLinkToNew.CheckSKUs(SKUList, SKUOIDList, CheckSKUs_CallBack);
}
//callback we told Ajax.Net to pass the response tos
function CheckSKUs_CallBack(response)
{
  //if the server side code threw an exception
  if (response.error != null)
  {    
    return;
  }  
  
  var OIDsNotFound = response.value; 
//alert(OIDsNotFound);

  if (OIDsNotFound == null)
  {
	return;  
  }
  OIDsNotFound = OIDsNotFound.replace(" ", "")
  if (OIDsNotFound == '')
  {
	document.getElementById("lblMessage").innerHTML = "All product codes were verified."
	return;
  }
  else
  {	
		while (OIDsNotFound.indexOf('|') != -1)
		{
			var strOID = OIDsNotFound.substring(0, OIDsNotFound.indexOf('||'));
			OIDsNotFound = OIDsNotFound.substring(OIDsNotFound.indexOf('||') + 2);
			ChangeStyle(strOID);
		}	
		if (OIDsNotFound != '') { ChangeStyle(OIDsNotFound);   }
		document.getElementById("lblMessage").innerHTML = "Unverified product codes are shown in red."		
  }
	
}

function ChangeStyle(OIDNotFound)
{
	
	//alert(OIDNotFound);
	var lbl = document.getElementById("div" + OIDNotFound);
	if (lbl != null) 	{ 	lbl.style.color = "#ff0000";  lbl.style.font = "11pt arial bold";	}
}

function ChangeBGColor(divID)
{
	document.getElementById(divID).style.background = "#ffffff";
}

function ChangeBGColorBack(divID)
{
	document.getElementById(divID).style.background = "#eef6fe";
}

function settocfromparent(CatalogOID, PageIndex, Embedded)
{
    ActiveMerchandiser.catalogview.GetTOC(CatalogOID, PageIndex, Embedded, settoc_CallBackforParent);

}


function settoc_CallBackforParent(response) {
    //if the server side code threw an exception
    if (response.error != null) {
        //alert(response.error); //we should probably do better than this
        return;
    }

    var strtoc = response.value;
    //alert(strtoc);
    //if the response wasn't what we expected  
    if (strtoc == null) {
        return;
    }
    var lbl = window.document.getElementById("divtoc");

    //alert(strtoc);
    lbl.innerHTML = strtoc;
}

function settoc(CatalogOID, PageIndex, Embedded)
{
    ActiveMerchandiser.pagetemplatecatalogview.GetTOC(CatalogOID, PageIndex, Embedded, '', settoc_CallBack);
}



//callback we told Ajax.Net to pass the response tos
function settoc_CallBack(response)
{
  //if the server side code threw an exception
  if (response.error != null)
  {    
    //alert(response.error); //we should probably do better than this
    return;
  }  
  
  var strtoc = response.value; 
  //alert(strtoc);
        //if the response wasn't what we expected  
  if (strtoc == null)
  {
    return;  
  }
  var lbl = window.parent.document.getElementById("divtoc");
  
	//alert(strtoc);
  lbl.innerHTML = strtoc; 
}

function showtoc()
{
	if (document.getElementById("divtoc").innerHTML != "")
	{
		document.getElementById("divtoc").style.visibility = "visible";
		document.getElementById("imgTOC").src = "images/shared/table_of_contents_on.gif";
	}
}

function hidetoc()
{
	//alert(document.getElementById("divtoc") == null);
	document.getElementById("divtoc").style.visibility = "hidden";
		document.getElementById("imgTOC").src = "images/shared/table_of_contents_off.gif";
}

function AnyQuantityEntered() 
{
	for (i=0; i < document.TemplateForm.elements.length; i ++)
	{
		if (document.TemplateForm.elements[i].id.indexOf("txt") != -1)
			if (document.TemplateForm.elements[i].value != "")
				return true;			
	}
	return false;
}
		
function AddToOrder()
{
	if (document.getElementById('HidSKUsforInvalid').value == "" )
	{
		if (AnyQuantityEntered())
		{
			document.getElementById("HidCommand").value="AddToOrder";
			document.TemplateForm.submit();
		}
		else
		{
			alert("Please enter quantity for at least one item.");
		}
	}
	else
	{
		alert("Invalid quantity entry for Item #" + document.getElementById('HidSKUsforInvalid').value + ".");
	}
}
			
function ValidateAll()
{
	var ListofData = document.getElementById("HidValidationInfo").value;
	alert(ListofData);
	while (ListofData.indexof(';') != -1)
	{
		var strSubstring = ListofData.substr(0, ListofData.indexof(';'))
					
		var sku = strSubstring.substr(0, strSubstring.indexof(','))
		strSubstring = strSubstring.substr(strSubstring.indexof(','))
		var min = strSubstring.substr(0, strSubstring.indexof(','))
		var incre = strSubstring.substr(strSubstring.indexof(','))
		alert('sku=' + sku + 'min' + min + 'incre' + incre);
		ValidateQuantity(sku, min, incre);
	}
}

function ValidateQuantity(sku, minimum, increment)
{
	var Valid = true;
	var ErrorMessage = "";
	if (document.getElementById('txt' + sku).value != "")
	{
		Valid = IsInteger('txt' + sku);
               
		if (Valid == false)
		ErrorMessage = "Please enter an integer quantity for Item #" + sku + ".";
						
		//quantity must be a multiple of increment
		if (Valid == true)
		{
			intQuantity = parseInt(document.getElementById('txt' + sku).value);
			//quantity must be larger than Minimum
			if (intQuantity < minimum)
			{
				//Valid = false;
				ErrorMessage += "The quantity entered for Item #" + sku + " must be larger than " + minimum + "."
				document.getElementById('txt' + sku).value = minimum
			}
			intQuantity = parseInt(document.getElementById('txt' + sku).value);
			var Mode = 0;
			if (increment != 0) Mode = intQuantity % increment;
			if (Mode != 0)
			{
				Valid = false;
				ErrorMessage += "The quantity entered for Item #" + sku + " must be a multiple of " + increment + "."
			}
		}
	}
	var strHidSKUsforInvalid = document.getElementById('HidSKUsforInvalid').value;
	if (Valid==false)
	{	
		if (strHidSKUsforInvalid.indexOf(sku) == -1)
		{
			if (document.getElementById('HidSKUsforInvalid').value != "")
				document.getElementById('HidSKUsforInvalid').value += ", ";
			document.getElementById('HidSKUsforInvalid').value += "#" + sku;
						
		}
	}
	else
	{
		if (strHidSKUsforInvalid.indexOf("#" + sku) != -1)
		{
			if (strHidSKUsforInvalid.indexOf("#" + sku) == strHidSKUsforInvalid.length - sku.length - 1)
				if (strHidSKUsforInvalid.length != sku.length + 1)
					strHidSKUsforInvalid = strHidSKUsforInvalid.replace(", " + "#" + sku, "");
				else
					strHidSKUsforInvalid = strHidSKUsforInvalid.replace("#" + sku, "");
			else	
				strHidSKUsforInvalid = strHidSKUsforInvalid.replace("#" + sku + ", ", "");
							
			document.getElementById('HidSKUsforInvalid').value = strHidSKUsforInvalid;
						
		}
					
				
	}
	if (ErrorMessage != "")
		alert(ErrorMessage);
}
			
function IsInteger(ID)
{
				
	var intValue = parseInt(document.getElementById(ID).value);
	if (!isNaN(intValue))
	{
		//alert("true");
		document.getElementById(ID).value = intValue;
		return true;
	}
	if (isNaN(intValue))
	{
		//alert("false");
		return false;
	}
}


function ValidatePageNumber()
{
	var CurrentValue = document.getElementById("hidToPageOrSearch").value.toLowerCase();
				
    if (CurrentValue == "page")
	{
		var pageNo=document.TemplateForm.txtPageNo;
		if ((pageNo.value==null)||(pageNo.value==""))
		{
			alert("You did not enter a page number.\n\nPlease enter a page number and click on the Go button.\n");
			//pageNo.focus()
			return false;
		}
		
		if  (!IsNumeric(pageNo.value))
		{
			alert("You did not enter a numeric value.\n\nPlease enter a numeric value and click on the Go button.\n");
			return false;
		}
		return true;
	}
	else
	{
		return true;
	}
}
 
function IsNumeric(strString)
{
	var strNumbers = "0123456789";
	var strEntry;
	var blnResult = true;
	
	if (strString.length == 0) return false;

   //check whether strString consists of valid numeric characters listed above in strNumbers
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strEntry = strString.charAt(i);
      if (strNumbers.indexOf(strEntry) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;

}