function findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

/*  You can get this script and many others 
    by visiting JavaScript City at: http://www.javascriptcity.com . */

pic_width=570;   /*change to match the height of all your images */
pic_height=275;   /* change to match the width of all your images */

/* define image urls */

if (document.images)
 {
     pic1= new Image(pic_width,pic_height);
     pic1.src="/assets/index_modo.jpg";  
     pic2= new Image(pic_width,pic_height); 
     pic2.src="/assets/index_easychair.jpg"; 
     pic3= new Image(pic_width,pic_height);
     pic3.src="/assets/index_modoblue.jpg";  
     pic4= new Image(pic_width,pic_height);
     pic4.src="/assets/index_modowire.jpg";  
     pic5= new Image(pic_width,pic_height);
     pic5.src="/assets/index_chess.jpg"; 
	 pic6= new Image(pic_width,pic_height);
     pic6.src="/assets/index_chesszoom.jpg"; 
 }     

/* no need to edit past this point (unless you want to add more image slots) */
//-->

function get_random(maxNum)
{
  if (Math.random && Math.round)
  {
    var ranNum= Math.round(Math.random()*(maxNum-1));
    ranNum+=1;
    return ranNum;
  }
  else
  {
  today= new Date();
  hours= today.getHours();
  mins=   today.getMinutes();
  secn=  today.getSeconds();
  if (hours==19)
   hours=18;
  var ranNum= (((hours+1)*(mins+1)*secn)%maxNum)+1;
  return ranNum;
  }
}

function get_Image()
{
 if (document.images)
 {
  var choose_one= get_random(6);  
  choose_one--;

  var pics= new Array(6) 
   pics[0]=pic1.src;
   pics[1]=pic2.src;
   pics[2]=pic3.src;
   pics[3]=pic4.src;
   pics[4]=pic5.src;
   pics[5]=pic6.src; 

  document.write("<IMG SRC='"+pics[choose_one]+"' width='"+pic_width+"' height='"+pic_height+"'>");
 }
}

function seltxtBold(){
	var seltext = null;
	seltext = (document.all)? document.selection.createRange() : document.getSelection();
	if (seltext.text != ""){
		seltext.text = "<b>" + seltext.text + "</b>";
		//seltext.execCommand("Bold")
		//seltext.select()

	}
	window.focus()
}

function seltxtItalic(){
	var seltext = null;
	seltext = (document.all)? document.selection.createRange() : document.getSelection();
	if (seltext.text != ""){
		seltext.text = "<i>" + seltext.text + "</i>";
	}
	window.focus()
}

function seltxtLink(){
	var seltext = null;
	seltext = (document.all)? document.selection.createRange() : document.getSelection();
	if (seltext.text != ""){
		repltext = prompt('Type in the link here:', ' ');
		repltext = "<a href=" + repltext + ">" + seltext.text + "</a>"; 
		seltext.text = repltext;
	}
	window.focus()
}
function mapPopupWindow() {
    newWindow = window.open("http://_prjDomain_/map_pop.asp?_PrjAbv__PageAbv_BodyMapImage=<% =_PrjAbv__PageAbv_BodyMapImage %>&_PrjAbv__PageAbv_BodyMapText=<% =_PrjAbv__PageAbv_BodyMapText %>","newWindow","titlebar=no,directories=no,width=390,height=359,left=500,top=250");
}   

// === ta buttons ====

function taExeCom(taCommand){
   CopiedTxt = document.selection.createRange();
   CopiedTxt.execCommand(taCommand);
}

function taPaste(taName){ //taForm, taElement
//   CopiedTxt = (document.all)? document.selection.createRange() : document.getSelection();
//   CopiedTxt.execCommand("Paste");
//   window.focus()
   
   //document.Form1.txtArea.focus();
   document.formCms.elements[taName].focus();
   //PastedText = document.Form1.txtArea.createTextRange();
   PastedText = document.formCms.elements[taName].createTextRange();
   PastedText.execCommand("Paste");
}

function taBold(){
	var seltext = null;
	seltext = (document.all)? document.selection.createRange() : document.getSelection();
	if (seltext.text != ""){
		seltext.text = "<b>" + seltext.text + "</b>";
		//seltext.execCommand("Bold")
		//seltext.select()

	}
	window.focus()
}

function taItalic(){
	var seltext = null;
	seltext = (document.all)? document.selection.createRange() : document.getSelection();
	if (seltext.text != ""){
		seltext.text = "<i>" + seltext.text + "</i>";
	}
	window.focus()
}

function taLink(){
	var seltext = null;
	seltext = (document.all)? document.selection.createRange() : document.getSelection();
	if (seltext.text != ""){
		repltext = prompt('Type in the link here:', ' ');
		repltext = "<a href=" + repltext + ">" + seltext.text + "</a>"; 
		seltext.text = repltext;
	}
	window.focus()
}

// === Trim ====
function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function
// === RTrim ====
function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function
// === LTrim ====
function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function

