//pop-closeup


var download_logos 	= "yes"		// "yes" FOR THE DOWNLOAD ICONS TO SHOW
var close_button_s 	= "yes"		// SOUND CLOSE BUTTON ON/OFF
var show_flash 		= "yes"		// SHOW THE FLASH OPTION
var show_realaudio 	= "yes"		// SHOW THE REALAUDIO OPTION
var show_quicktime 	= "yes"		// SHOW THE QUICKTIME OPTION
var show_windows 	= "yes"		// SHOW THE WINDOWS OPTION
var flash_text		= "Flash" 	// TEXT TO CHOOSE FLASH
var real_text		= "RealAudio" 	// TEXT TO CHOOSE REALAUDIO
var quick_text		= "Quicktime" 	// TEXT TO CHOOSE QUICKTIME
var windows_text	= "Windows Media" 	// TEXT TO CHOOSE WINDOWS
var close_location 	= "98" 		// MOVE THE SOUND CLOSE BUTTON UP OR DOWN
var view_sound_width 	=  600		// SOUND POPUP WIDTH
var view_sound_height 	=  400		// SOUND POPUP HEIGHT
var right_click_onS	= "no"		// SOUND RIGHT CLICK PROTECTION ON
var song_title		= "yes"		// SHOW SONG FILE NAME


// GALLERY POPUPS

var close_button_p 	= "yes"		// GALLERY CLOSE BUTTON ON/OFF
var slideshow_button 	= "yes"		// SLIDESHOW BUTTON ON/OFF
var right_click_onG	= "yes"		// GALLERY RIGHT CLICK PROTECTION ON
var border_color	= "000000"	// PICTURE OUTLINE COLOR
var slideshow_width 	= 700		// SLIDESHOW POPUP WINDOW WIDTH
var slideshow_height 	= 525		// SLIDESHOW POPUP WINDOW HEIGHT
var view_width 		= 700		// GALLERY POPUP WIDTH
var view_height 	= 525		// GALLERY POPUP HEIGHT


// OTHER OPTIONS YOU CAN CHANGE


var scrollbarS 		= "0"		// TURN ON POPUP SCROLLBARS "1" FOR ON "0" FOR OFF
var scrollbarS_sound	= "0"		// TURN ON POPUP SCROLLBARS "1" FOR ON "0" FOR OFF
var background_image	= "images/background-popups.jpg"			// BACKROUND IMAGE IN MUSIC POPUPS
var background_colors	= "FFFFFF"					// BACKROUND COLOR OF THE POPUPS
var background_colors_S	= "000000"	// SIDEBAR COLOR OF THE POPUPS
var right_click_text	= "You may not right mouse click this page"	// TEXT FOR THE RIGHT CLICK PROTECTION




// COPYRIGHT 2003  Allwebco Design Corporation
// Unauthorized use or sale of this script is strictly prohibited by law

// YOU DO NOT NEED TO EDIT BELOW THIS LINE

// START SOUND POPUP CODE




function popUpSound(SONG) {
var look='toolbar=0,scrollbars='+scrollbarS_sound+',location=0,statusbar=0,menubar=0,resizable=0,width='+view_sound_width+',height='+view_sound_height+','
popwin=window.open("","",look)
popwin.document.open()
popwin.document.write('<html><head>');
popwin.document.write('<title>Player</title>');
popwin.document.write('<link rel=StyleSheet href="css/corporatestyle.css" type="text/css" media="screen">');
   if (right_click_onS == "yes") {
popwin.document.write('<META HTTP-EQUIV="imagetoolbar" CONTENT="no">')
popwin.document.write('<script language="JavaScript">')
popwin.document.write('function noRightClick() {')
popwin.document.write('if (event.button==2) {')
popwin.document.write('alert(\''+right_click_text+'\')')
popwin.document.write('}')
popwin.document.write('}')
popwin.document.write('document.onmousedown=noRightClick')
popwin.document.write('</script>')
}
popwin.document.write('</head>');
popwin.document.write('<BODY BGCOLOR="#'+background_colors+'" background="'+background_image+'" TEXT="#FFFFFF" LINK="#FFFFFF" VLINK="#FFFFFF" ALINK="#FFFFFF" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" marginheight="0" marginwidth="0">');
popwin.document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td bgcolor="#'+background_colors_S+'" width="43" align="center">');
popwin.document.write('<img src="images/popup-download.gif"><br>');
popwin.document.write('</td><td valign="middle" bgcolor="#'+background_colors_S+'" width="108">');
   if (download_logos == "yes") {


// START THE DOWNLOAD ICONS

   if (show_flash == "yes") {
popwin.document.write('<a href="http://www.macromedia.com/go/getflashplayer/" target="_blank"><img src="images/icon_flash.gif" border="0"></a><br><br>');
}
   if (show_realaudio == "yes") {
popwin.document.write('<a href="http://real.com" target="_blank"><img src="images/icon_real.gif" border="0"></a><br><br>');
}
   if (show_quicktime == "yes") {
popwin.document.write('<a href="http://www.apple.com" target="_blank"><img src="images/icon_quicktime.gif" border="0"></a><br><br>');
}
   if (show_windows == "yes") {
popwin.document.write('<a href="http://www.microsoft.com/windowsmedia" target="_blank"><img src="images/icon_windows.gif" border="0"></a><br>');
}

}
popwin.document.write('<img src="images/spacer.gif" width="108" height="1"><br>');
popwin.document.write('</td><td width="15">');
popwin.document.write('<img src="images/spacer.gif" width="15" height="20"><br>');
popwin.document.write('</td><td valign="top">');
popwin.document.write('<img src="images/popup-select.gif"><br>');
popwin.document.write('<img src="images/spacer.gif" width="10" height="105"><br>');
popwin.document.write('<table cellpadding="0" cellspacing="3" border="0" width="250"><tr><td width="40">');
   if (show_flash == "yes") {
popwin.document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="35" HEIGHT="20" id="popup_flash">');
popwin.document.write('<PARAM NAME=movie VALUE="popup_flash.swf?theFile='+SONG+'">');
popwin.document.write('<PARAM NAME=quality VALUE=high>');
popwin.document.write('<PARAM NAME=bgcolor VALUE=#FFFFFF>');
popwin.document.write('<EMBED src="popup_flash.swf?theFile='+SONG+'" quality=high bgcolor=#FFFFFF WIDTH="35" HEIGHT="20" NAME="popup_flash" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
popwin.document.write('</EMBED>');
popwin.document.write('</OBJECT><br>');
popwin.document.write('</td><td class="listen">');
popwin.document.write(''+flash_text+'<br>');
}
else
{
popwin.document.write('<br></td><td>');
popwin.document.write('<br>');
}
   if (show_realaudio == "yes") {
popwin.document.write('</td></tr><tr><td width="40">');
popwin.document.write('<a href="javascript:RealPlayer()"><img src="images/popup-player.gif" border="0"></a><br>');
popwin.document.write('<Script Language="JavaScript">\n');
popwin.document.write('function RealPlayer(){\n');
popwin.document.write('document.writeln(\'<html><head>\');\n');
popwin.document.write('document.writeln(\'<title>Player</title>\');\n');
popwin.document.write('document.writeln(\'<link rel=StyleSheet href="css/corporatestyle.css" type="text/css" media="screen">\');\n');
popwin.document.write('document.writeln(\'</head>\');\n');
popwin.document.write('document.writeln(\'<BODY BGCOLOR="#'+background_colors+'" background="'+background_image+'" TEXT="#FFFFFF" LINK="#FFFFFF" VLINK="#FFFFFF" ALINK="#FFFFFF" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" marginheight="0" marginwidth="0">\');\n');
popwin.document.write('document.writeln(\'<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td valign="middle" align="center">\');\n');
popwin.document.write('document.writeln(\'<object id=RVOCX classid="CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="375" height="100">\');\n');
popwin.document.write('document.writeln(\'<param name="SRC" value="'+SONG+'">\');\n');
popwin.document.write('document.writeln(\'<param name="CONTROLS" value="All">\');\n');
popwin.document.write('document.writeln(\'<param name="CONSOLE" value="one">\');\n');
popwin.document.write('document.writeln(\'<PARAM NAME="AUTOSTART" VALUE="true">\');\n');
popwin.document.write('document.writeln(\'<embed src="'+SONG+'" type="audio/x-pn-realaudio-plugin" width="375" height="100" NOJAVA="true" controls="ControlPanel" console="one" AUTOSTART="false">\');\n');
popwin.document.write('document.writeln(\'</EMBED>\');\n');
popwin.document.write('document.writeln(\'</OBJECT><br>\');\n');
   if (close_button_s == "yes") {
popwin.document.write('document.writeln(\'<br><a href="javascript:self.close()"><img src="images/popup-close.gif" border="0" style="border: #FFFFFF 1px solid"></a><br>\');\n');
}
popwin.document.write('document.writeln(\'</td></tr></table>\');\n');
popwin.document.write('document.writeln(\'</BODY></HTML>\');\n');
popwin.document.write('}\n');
popwin.document.write('</script>\n');
popwin.document.write('</td><td class="listen">');
popwin.document.write(''+real_text+'<br>');
}
   if (show_quicktime == "yes") {
popwin.document.write('</td></tr><tr><td width="40">');
popwin.document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="35" HEIGHT="20" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">');
popwin.document.write('<PARAM name="SRC" VALUE="popup-quicktime.mov">');
popwin.document.write('<PARAM name="HREF" VALUE="'+SONG+'">');
popwin.document.write('<PARAM name="AUTOPLAY" VALUE="true">');
popwin.document.write('<PARAM name="TARGET" VALUE="QuickTimePlayer">');
popwin.document.write('<PARAM name="CONTROLLER" VALUE="FALSE">');
popwin.document.write('<EMBED SRC="popup-quicktime.mov" HREF="'+SONG+'" TARGET="QuickTimePlayer" WIDTH="35" HEIGHT="20" AUTOPLAY="true" CONTROLLER="false" PLUGINSPAGE="http://www.apple.com/quicktime/download/">');
popwin.document.write('</EMBED>');
popwin.document.write('</OBJECT><br>');
popwin.document.write('</td><td class="listen">');
popwin.document.write(''+quick_text+'<br>');
}
   if (show_windows == "yes") {
popwin.document.write('</td></tr><tr><td width="40">');
popwin.document.write('<table cellpadding="0" cellspacing="0" border="0"><tr><td>');
popwin.document.write('<INPUT TYPE="image" src="images/popup-player-win.gif" NAME="BtnPlay" VALUE="Play" OnClick="StartMeUp()"><br></td><td>');
popwin.document.write('<INPUT TYPE="image" src="images/popup-player_stop-win.gif" NAME="BtnStop" VALUE="Stop" OnClick="ShutMeDown()"></td><td>');
popwin.document.write('<div id="wm-location">');
popwin.document.write('<OBJECT ID="Player" width="152" height="'+view_sound_height+'" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">');
popwin.document.write('<PARAM NAME="autoStart" VALUE="false">');
popwin.document.write('<PARAM name="URL" value="'+SONG+'">');
popwin.document.write('<PARAM name="uiMode" value="none">');
popwin.document.write('</OBJECT>');
popwin.document.write('</div>');
popwin.document.write('</td></tr></table>');
   popwin.document.write('\n');
   popwin.document.write('<script>\n');
   popwin.document.write('<!--\n');
   popwin.document.write('function StartMeUp ()\n');
   popwin.document.write('{\n');
       popwin.document.write('Player.controls.play();\n');
   popwin.document.write('}\n');
   popwin.document.write('function ShutMeDown ()\n');
   popwin.document.write('{\n');
       popwin.document.write('Player.controls.stop();\n');
   popwin.document.write('}\n');
   popwin.document.write('-->\n');
   popwin.document.write('</SCRIPT>\n');
   popwin.document.write('<SCRIPT LANGUAGE="VBScript">\n');
   popwin.document.write('<!--\n');
 popwin.document.write('On error resume next\n');
   popwin.document.write('Player.URL = ""\n');
   popwin.document.write('if err then msgbox "You need Windows Media Player 7. Go to" & chr(13) &_\n');
        popwin.document.write('"http://www.microsoft.com/windowsmedia"\n');
     popwin.document.write('err.clear\n');
   popwin.document.write('-->\n');
   popwin.document.write('</SCRIPT>\n');
popwin.document.write('</td><td class="listen" valign="top">');
popwin.document.write(''+windows_text+'<br>');
}
popwin.document.write('</td></tr></table>');
popwin.document.write('<img src="images/spacer.gif" width="15" height="'+close_location+'"><br>');
popwin.document.write('<div id="music-closebutton">');
popwin.document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td>');
   if (song_title == "yes") {
popwin.document.write('FILE: '+SONG+'');
}
popwin.document.write('&nbsp;<br>');
popwin.document.write('</td><td width="130">');
   if (close_button_s == "yes") {
popwin.document.write('<a href="javascript:self.close()"><img src="images/popup-close.gif" border="0" onmouseover="this.style.border=\'#000000 1px solid\'" onmouseout="this.style.border=\'#'+background_colors+' 1px solid\'" style="border: #FFFFFF 1px solid" hspace="8"></a><br>');
}
popwin.document.write('</td></tr></table>');
popwin.document.write('</div>');
popwin.document.write('</td></tr></table>');
popwin.document.write('</BODY></HTML>');
popwin.document.close()
}



// START SLIDESHOW POPUP CODE


function popUpSlideshow(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars='+scrollbarS+',location=0,statusbar=0,menubar=0,resizable=1,width='+slideshow_width+',height='+slideshow_height+'');");
}


// START POPUP CODE


function popUp(URL) {
var look='toolbar=0,scrollbars='+scrollbarS+',location=0,statusbar=0,menubar=0,resizable=1,width='+view_width+',height='+view_height+','
popwin=window.open("","",look)
popwin.document.open()
popwin.document.write('<title>Image Close Up</title>')
   if (right_click_onG == "yes") {
popwin.document.write('<META HTTP-EQUIV="imagetoolbar" CONTENT="no">')
popwin.document.write('<script language="JavaScript">')
popwin.document.write('function noRightClick() {')
popwin.document.write('if (event.button==2) {')
popwin.document.write('alert(\''+right_click_text+'\')')
popwin.document.write('}')
popwin.document.write('}')
popwin.document.write('document.onmousedown=noRightClick')
popwin.document.write('</script>')
}
popwin.document.write('<head>')
popwin.document.write('<link rel=StyleSheet href="css/corporatestyle.css" type="text/css" media="screen"></head>')
popwin.document.write('<body bgcolor="#'+background_colors+'" background="'+background_image+'" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" marginheight="0" marginwidth="0">')
popwin.document.write('<TABLE cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td align="center">')
popwin.document.write('<br>')
popwin.document.write('<table cellspacing="0" cellpadding="1" border="0"><tr><td align="center">')
popwin.document.write('<TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#'+border_color+'" style="border-collapse: collapse"><tr><td>')
popwin.document.write('<img src="'+URL+'">')
popwin.document.write('</td></tr></table><br>')
popwin.document.write('</td></tr><tr><td valign="top" align="center" height="50">')
popwin.document.write('<TABLE cellpadding="0" cellspacing="0" border="0"><tr><td>')
   if (close_button_p == "yes") {
popwin.document.write('<form style="margin: 0px"><input type="button" value="Close" onmouseover="this.className=\'buttonon-popups\'" onmouseout="this.className=\'button-popups\'" class="button-popups" onClick=\'self.close()\'>&nbsp;</form>')
}
   if (slideshow_button == "yes") {
popwin.document.write('</td><td>')
popwin.document.write('<form action="slideshow.htm" style="margin: 0px"><input type="submit" value="Slideshow" onmouseover="this.className=\'buttonon-popups\'" onmouseout="this.className=\'button-popups\'" class="button-popups"></form>')
}
popwin.document.write('</td></tr></table>')
popwin.document.write('</td></tr></table>')
popwin.document.write('</td></tr></table>')
popwin.document.write('</body>')
popwin.document.close()
}



// Begin SMALL MESSAGES CODE


document.write('<div Class="divstyle" id="info" style=\'display:none;\'>')
document.write('<div id="imagetitle" class="pstyletitle" align="center"></div>')
document.write('</div>')


var IE = document.all?true:false

if (!IE) document.captureEvents(Event.MOUSEMOVE)

//document.onmousemove = getMouseXY;

var tempX = 0
var tempY = 0

  
function getMouseXY(e) {
  if (IE && event) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
obj_info = document.getElementById("info")
obj_info.style.top = tempY + 10;
obj_info.style.left = tempX + 10;
  return true
}

function alert_msg(titletext){
obj_info = document.getElementById("info")
obj_info.style.display = '';
obj_imagetitle = document.getElementById("imagetitle");
obj_imagetitle.innerHTML = titletext;

}

function away()
{
obj_info = document.getElementById("info")
obj_info.style.display = 'none';
}


function goToURL() { history.go(-1); }


 




//stylechanger.js
var prefsLoaded = false;
var defaultFontSize = 100;
var currentFontSize = defaultFontSize;

function revertStyles() {
    currentFontSize = defaultFontSize;
    changeFontSize(0);
    els = getElementsByClassName();
    for(var k=0; k < els.length; k++)
	els[k].style.fontSize = '';
}

function toggleColors(){
    if(currentStyle == "White"){
	setColor("Black");
    }else{
	setColor("White");
    }
}

function getElementsByClassName(container) {
    container = container||document;
    var all = container.all||container.getElementsByTagName('*');
    var arr = [];
    for(var k=0;k<all.length;k++)
	if(all[k].className.substr(0, 4) == 'font'){
	    arr[arr.length] = all[k];}
    return arr;
}

function changeFontSize(sizeDifference){
    currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference * 5);

    createCookie("fontSize", currentFontSize, 365);
    setFontSize(currentFontSize, sizeDifference);
};

function setFontSize(fontSize, sDiff){
    var stObj = (document.getElementById) ? document.getElementById('content_area') : document.all('content_area');
    stObj = stObj ? stObj : document.body;
    stObj.style.fontSize = fontSize + '%';
    els = getElementsByClassName();
    for(var k=0; k < els.length; k++) {
	if (navigator.appName == "Microsoft Internet Explorer")
	    elStyle = els[k].currentStyle;
	else
	    elStyle = window.getComputedStyle(els[k], null);
	strS = elStyle.fontSize;
	elFSize = parseFloat(strS);
	elFNewSize = elFSize + (elFSize * parseInt(sDiff) *  0.05);
	qq = elFSize + '';
	meaz = strS.substr(qq.length, 2);
	els[k].style.fontSize = elFNewSize + meaz;
    }
};

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
};

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
};

function setUserOptions(){
	if(!prefsLoaded){
	    cookie = readCookie("fontSize");
	    currentFontSize = cookie ? cookie : defaultFontSize;
	    fdiff = (parseInt(currentFontSize) - defaultFontSize) / 5;
	    setFontSize(currentFontSize, fdiff);
	    prefsLoaded = true;
	}
}



//formtooltip.js

function findPosX(obj) {
  var curleft = 0;
  if (obj.offsetParent) {
    while (1) {
      curleft+=obj.offsetLeft;
      if (!obj.offsetParent) {
	break;
      }
      obj=obj.offsetParent;
    }
  } else if (obj.x) {
    curleft+=obj.x;
  }
  return curleft;
}
function findPosY(obj) {
  var curtop = 0;
  if (obj.offsetParent) {
    while (1) {
      curtop+=obj.offsetTop;
      if (!obj.offsetParent) {
	break;
      }
      obj=obj.offsetParent;
    }
  } else if (obj.y) {
    curtop+=obj.y;
  }
  return curtop;
}

function showTip(el, direction, parentId) {
  elem = document.getElementById(el);
  parentEl = document.getElementById(parentId);
  if (direction == 'right'){
    var a = findPosX(parentEl);
    var b = parentEl.offsetWidth;
    elem.style.left = parseInt(a + b) + 'px';}
  else if (direction == 'left') 
    elem.style.left = parseInt(findPosX(parentEl)) + 'px';
  elem.style.top = parseInt(findPosY(parentEl)) + 'px';
  elem.style.width = parseInt(parentEl.offsetWidth) + 'px';
  elem.style.position = 'absolute';
  elem.style.display = 'block';
  elem.zIndex = 1000;
}

function hideTip(el) {
  elem = document.getElementById(el); 
  elem.style.display = 'none';
}




//mainmenu.js

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_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

/************************************** Text Scroll********************************************************/
function TextScroll(scrollname, div_name, up_name, down_name)
{
  this.div_name = div_name;
  this.name = scrollname;
  this.scrollCursor = 0;
  this.speed = 5;
  this.timeoutID = 0;
  this.div_obj = null;
  this.up_name = up_name;
  this.dn_name = down_name;
  {
    if(document.getElementById){
      div_obj = document.getElementById(this.div_name);
      if(div_obj){
        this.div_obj = div_obj;
        this.div_obj.style.overflow = 'hidden';
      }
      div_up_obj = document.getElementById(this.up_name);
      div_dn_obj = document.getElementById(this.dn_name);
      if(div_up_obj && div_dn_obj){
        div_up_obj.onmouseover = function(){eval(scrollname + ".scrollUp();")};
        div_up_obj.onmouseout = function(){eval(scrollname + ".stopScroll();")};
        div_dn_obj.onmouseover = function(){eval(scrollname + ".scrollDown();")};
        div_dn_obj.onmouseout = function(){eval(scrollname + ".stopScroll();")};
      }
    }
  }
  this.stopScroll = function(){
    clearTimeout(this.timeoutID);
  }
  this.scrollUp = function(){
    if(this.div_obj){
      this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
      this.div_obj.scrollTop = this.scrollCursor;
      this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
    }
  }
  this.scrollDown = function(){
    if(this.div_obj){
      this.scrollCursor += this.speed;
      this.div_obj.scrollTop = this.scrollCursor;
      if(this.div_obj.scrollTop == this.scrollCursor){
        this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
      }else{
        this.scrollCursor = this.div_obj.scrollTop;
      }
    }
  }
  this.resetScroll = function(){
    if(this.div_obj){
      this.div_obj.scrollTop = 0;
      this.scrollCursor = 0;
    }
  }
}

/**********************************Main menu************************************************/
var defaultSubMenuId = null;
var currentTab = null;
var defaultTab = null;
var overtimer = null;
var timer = null;
var clickyes = 0;

function mainMenu(menuId, selectedIndex, menuVar)
{
    var subMenus = new Array();
    var subSubMenus = new Array();
    var menuName = menuVar;


    function init(id, index)
    {
        var menu = document.getElementById(id);
        var tabs = menu.getElementsByTagName("a");
        for (var i=0; i<tabs.length; i++)
        {
            if (tabs[i].getAttribute("rel"))
            {
                subMenus[i] = tabs[i].getAttribute("rel");
                var subMenu = document.getElementById(subMenus[i]);
                
                tabs[i].onmouseover=function()
                {
                    currentTab = this;
                    clearTimeout(overtimer);
                    clearTimeout(timer);
                    overtimer = setTimeout("show();", 600);
                }
                
                subMenu.onmouseover=function()
                {
                    currentTab = tabs[i];
                    clearTimeout(overtimer);
                    clearTimeout(timer);
                }
                
                if (i == selectedIndex)
                {
                    tabs[i].href = "javascript:void(0);";
                    currentTab = tabs[i];
                    defaultTab = tabs[i];
                    defaultSubMenuId = subMenus[i];
                    show(tabs[i]);
                }
                else
                {
                    tabs[i].onmouseout=function()
                    {
                       clearTimeout(overtimer);
                       clearTimeout(timer);
                       if ( clickyes == 0 )timer = setTimeout("showDefault()", 2000);
                    }

                    tabs[i].onclick=function()
                    {
                        timer = setTimeout("showDefault()", 200000);
                        clickyes = 1;
                    }

                    subMenu.onmouseout=function()
                    {
                        clearTimeout(overtimer);
                        clearTimeout(timer);
                        if ( clickyes == 0 )timer = setTimeout("showDefault()", 2000);
                    }
                }
            }
        }
	}
    init(menuId, selectedIndex);    
    
    function showSubSubMenu(curTab)
    {
        var ct = curTab.getAttribute("rel");
        
        if (ct)
            document.getElementById(ct).style.display="block";
    }
    
    function hideSubSubMenu(ssm)
    {
        if (ssm)
            ssm.style.display="none";
    }
}

function hideAll()
{
    var menu = document.getElementById("mainMenu");
    var tabs = menu.getElementsByTagName("a");
    for (var i=0; i<tabs.length; i++)
    {
        var divs = tabs[i].getElementsByTagName('div');
        if (divs && divs.length)
            divs[0].className = '';
            
        if (tabs[i].getAttribute("rel"))
        {
            var subId = tabs[i].getAttribute("rel");
            var subMenu = document.getElementById(subId);
            subMenu.style.display = "none";
        }
    }
}

function show()
{
    hideAll();
    var ct = currentTab.getAttribute("rel");
    var divs = currentTab.getElementsByTagName('div');
    
    if (ct)
        document.getElementById(ct).style.display="block";
    if (divs && divs.length)
        divs[0].className = 'selected';
}

function showDefault()
{
    var s = document.getElementById(defaultSubMenuId);
    hideAll();
    
    if (s) {
        s.style.display="block";
    }
    
    var divs = defaultTab.getElementsByTagName('div');
    if (divs && divs.length)
            divs[0].className = 'selected';
}




//plone_javascript_variables

// Global Plone variables that need to be accessible to the Javascripts
var portal_url = 'http://www.farlang.com';
var form_modified_message = 'Your form has not been saved. All changes you have made will be lost.';
var form_resubmit_message = 'You already clicked the submit button. Do you really want to submit this form again?';

// the following are flags for mark_special_links.js
// links get the target="_blank" attribute
var external_links_open_new_window = false;
// apply only to links in content area (id="content" or id="region-content")
var external_links_in_content_only = true;



//plone_javascripts
function registerPloneFunction(func){if(window.addEventListener)window.addEventListener("load",func,false);else if(window.attachEvent)window.attachEvent("onload",func);}
function unRegisterPloneFunction(func){if(window.removeEventListener)window.removeEventListener("load",func,false);else if(window.detachEvent)window.detachEvent("onload",func);}
function getContentArea(){node=document.getElementById('region-content')
if(!node){node=document.getElementById('content')}
return node}
function wrapNode(node,wrappertype,wrapperclass){wrapper=document.createElement(wrappertype)
wrapper.className=wrapperclass;innerNode=node.parentNode.replaceChild(wrapper,node);wrapper.appendChild(innerNode)}
function showDay(date){document.getElementById('day'+date).style.visibility='visible';return true;}
function hideDay(date){document.getElementById('day'+date).style.visibility='hidden';return true;}
function setFocus(){var xre=new RegExp(/\berror\b/);for(var f=0;(formnode=document.getElementsByTagName('form').item(f));f++){for(var i=0;(node=formnode.getElementsByTagName('div').item(i));i++){if(xre.exec(node.className)){for(var j=0;(inputnode=node.getElementsByTagName('input').item(j));j++){inputnode.focus();return;}}}}}
registerPloneFunction(setFocus)
function compare(a,b)
{au=new String(a);bu=new String(b);if(au.charAt(4)!='-'&&au.charAt(7)!='-')
{var an=parseFloat(au)
var bn=parseFloat(bu)}
if(isNaN(an)||isNaN(bn))
{as=au.toLowerCase()
bs=bu.toLowerCase()
if(as>bs)
{return 1;}
else
{return-1;}}
else{return an-bn;}}
function getConcatenedTextContent(node){var _result="";if(node==null){return _result;}
var childrens=node.childNodes;var i=0;while(i<childrens.length){var child=childrens.item(i);switch(child.nodeType){case 1:case 5:_result+=getConcatenedTextContent(child);break;case 3:case 2:case 4:_result+=child.nodeValue;break;case 6:case 7:case 8:case 9:case 10:case 11:case 12:break;}
i++;}
return _result;}
function sort(e){var el=window.event?window.event.srcElement:e.currentTarget;var a=new Array();if(el.nodeName=='IMG')el=el.parentNode;var name=el.childNodes.item(1).nodeValue;var dad=el.parentNode;var node;for(var im=0;(node=dad.getElementsByTagName("th").item(im));im++){if(node.lastChild.nodeName=='IMG')
{lastindex=node.getElementsByTagName('img').length-1;node.getElementsByTagName('img').item(lastindex).setAttribute('src',portal_url+'/arrowBlank.gif');}}
for(var i=0;(node=dad.getElementsByTagName("th").item(i));i++){var xre=new RegExp(/\bnosort\b/);if(!xre.exec(node.className)&&node.childNodes.item(1).nodeValue==name)
{lastindex=node.getElementsByTagName('img').length-1;node.getElementsByTagName('img').item(lastindex).setAttribute('src',portal_url+'/arrowUp.gif');break;}}
var tbody=dad.parentNode.parentNode.getElementsByTagName("tbody").item(0);for(var j=0;(node=tbody.getElementsByTagName("tr").item(j));j++){a[j]=new Array();a[j][0]=getConcatenedTextContent(node.getElementsByTagName("td").item(i));a[j][1]=getConcatenedTextContent(node.getElementsByTagName("td").item(1));a[j][2]=getConcatenedTextContent(node.getElementsByTagName("td").item(0));a[j][3]=node;}
if(a.length>1){a.sort(compare);if(a[0][0]==getConcatenedTextContent(tbody.getElementsByTagName("tr").item(0).getElementsByTagName("td").item(i))&&a[1][0]==getConcatenedTextContent(tbody.getElementsByTagName("tr").item(1).getElementsByTagName("td").item(i)))
{a.reverse();lastindex=el.getElementsByTagName('img').length-1;el.getElementsByTagName('img').item(lastindex).setAttribute('src',portal_url+'/arrowDown.gif');}}
for(var j=0;j<a.length;j++){tbody.appendChild(a[j][3]);}}
function initalizeTableSort(e){var tbls=document.getElementsByTagName('table');for(var t=0;t<tbls.length;t++)
{var re=new RegExp(/\blisting\b/)
var xre=new RegExp(/\bnosort\b/)
if(re.exec(tbls[t].className)&&!xre.exec(tbls[t].className))
{try{var tablename=tbls[t].getAttribute('id');var thead=document.getElementById(tablename).getElementsByTagName("thead").item(0);var node;blankarrow=document.createElement('img');blankarrow.setAttribute('src',portal_url+'/arrowBlank.gif');blankarrow.setAttribute('height',6);blankarrow.setAttribute('width',9);initialsort=false;for(var i=0;(node=thead.getElementsByTagName("th").item(i));i++){if(!xre.exec(node.className)){node.insertBefore(blankarrow.cloneNode(1),node.firstChild);if(!initialsort){initialsort=true;uparrow=document.createElement('img');uparrow.setAttribute('src',portal_url+'/arrowUp.gif');uparrow.setAttribute('height',6);uparrow.setAttribute('width',9);node.appendChild(uparrow);}else{node.appendChild(blankarrow.cloneNode(1));}
if(node.addEventListener)node.addEventListener("click",sort,false);else if(node.attachEvent)node.attachEvent("onclick",sort);}}}catch(er){}}}}
registerPloneFunction(initalizeTableSort)
function submitFolderAction(folderAction){document.folderContentsForm.action=document.folderContentsForm.action+'/'+folderAction;document.folderContentsForm.submit();}
function submitFilterAction(){document.folderContentsForm.action=document.folderContentsForm.action+'/folder_contents';filter_selection=document.getElementById('filter_selection');for(var i=0;i<filter_selection.length;i++){if(filter_selection.options[i].selected){if(filter_selection.options[i].value=='#'){document.folderContentsForm.filter_state.value='clear_view_filter';}
else{document.folderContentsForm.filter_state.value='set_view_filter';}}}
document.folderContentsForm.submit();}
function selectAll(id,formName){if(formName==null){checkboxes=document.getElementsByName(id)
for(i=0;i<checkboxes.length;i++)
checkboxes[i].checked=true;}else{for(i=0;i<document.forms[formName].elements.length;i++)
{if(document.forms[formName].elements[i].name==id)
document.forms[formName].elements[i].checked=true;}}}
function deselectAll(id,formName){if(formName==null){checkboxes=document.getElementsByName(id)
for(i=0;i<checkboxes.length;i++)
checkboxes[i].checked=false;}else{for(i=0;i<document.forms[formName].elements.length;i++)
{if(document.forms[formName].elements[i].name==id)
document.forms[formName].elements[i].checked=false;}}}
function toggleSelect(selectbutton,id,initialState,formName){id=id||'ids:list'
if(selectbutton.isSelected==null)
{initialState=initialState||false;selectbutton.isSelected=initialState;}
if(selectbutton.isSelected==false){selectbutton.setAttribute('src',portal_url+'/select_none_icon.gif');selectbutton.isSelected=true;return selectAll(id,formName);}
else{selectbutton.setAttribute('src',portal_url+'/select_all_icon.gif');selectbutton.isSelected=false;return deselectAll(id,formName);}}
function scanforlinks(){if(!document.getElementsByTagName){return false};if(!document.getElementById){return false};contentarea=getContentArea()
if(!contentarea){return false}
links=contentarea.getElementsByTagName('a');for(i=0;i<links.length;i++){if((links[i].getAttribute('href'))&&(links[i].className.indexOf('link-plain')==-1)){var linkval=links[i].getAttribute('href')
if(linkval.toLowerCase().indexOf(window.location.protocol+'//'+window.location.host)==0){}else if(linkval.indexOf('http:')!=0){protocols=['mailto','ftp','news','irc','h323','sip','callto','https']
for(p=0;p<protocols.length;p++){if(linkval.indexOf(protocols[p]+':')==0){wrapNode(links[i],'span','link-'+protocols[p])
break;}}}else{if(links[i].getElementsByTagName('img').length==0){a=1}}}}}
registerPloneFunction(scanforlinks)
function climb(node,word){if(!node){return false}
if(node.hasChildNodes){var i;for(i=0;i<node.childNodes.length;i++){climb(node.childNodes[i],word);}
if(node.nodeType==3){checkforhighlight(node,word);}}
function checkforhighlight(node,word){ind=node.nodeValue.toLowerCase().indexOf(word.toLowerCase());if(ind!=-1){if(node.parentNode.className!="highlightedSearchTerm"){par=node.parentNode;contents=node.nodeValue;hiword=document.createElement("span");hiword.className="highlightedSearchTerm";hiword.appendChild(document.createTextNode(contents.substr(ind,word.length)));par.insertBefore(document.createTextNode(contents.substr(0,ind)),node);par.insertBefore(hiword,node);par.insertBefore(document.createTextNode(contents.substr(ind+word.length)),node);par.removeChild(node);}}}}
function correctPREformatting(){contentarea=getContentArea();if(!contentarea){return false}
pres=contentarea.getElementsByTagName('pre');for(i=0;i<pres.length;i++){wrapNode(pres[i],'div','visualOverflow')}}
function highlightSearchTerm(){query=window.location.search;if(typeof decodeURI!='undefined'){query=unescape(decodeURI(query))}
else{return false}
if(query){var qfinder=new RegExp()
qfinder.compile("searchterm=([^&]*)","gi")
qq=qfinder.exec(query)
if(qq&&qq[1]){query=qq[1]
if(!query){return false}
queries=query.replace(/\+/g,' ').split(/\s+/)
contentarea=getContentArea();for(q=0;q<queries.length;q++){if(queries[q].toLowerCase()!='not'&&queries[q].toLowerCase()!='and'&&queries[q].toLowerCase()!='or'){climb(contentarea,queries[q]);}}}}}
registerPloneFunction(highlightSearchTerm);function climbPage(node,word,klass,comm,klass1){if(!node){return false}
if(node.hasChildNodes){var i;for(i=0;i<node.childNodes.length;i++){climbPage(node.childNodes[i],word,klass,comm,klass1);}
if(node.nodeType==3){checkforhighlightPage(node,word,klass,comm,klass1);}}
function checkforhighlightPage(node,word,klass,comm,klass1){ind=node.nodeValue.toLowerCase().indexOf(word.toLowerCase());if(ind!=-1){if(node.parentNode.className!=klass){par=node.parentNode;contents=node.nodeValue;hiword=document.createElement("span");hiword.className=klass;hiword.appendChild(document.createTextNode(contents.substr(ind,word.length)));par.insertBefore(document.createTextNode(contents.substr(0,ind)),node);par.insertBefore(hiword,node);if(comm){br=document.createElement("br");br1=document.createElement("br");commword=document.createElement("span");cm=document.createElement("b");cm.appendChild(document.createTextNode('comment: '));commword.className=klass1;commword.appendChild(br);commword.appendChild(cm);commword.appendChild(document.createTextNode(comm));commword.appendChild(br1);par.insertBefore(commword,node);}
par.insertBefore(document.createTextNode(contents.substr(ind+word.length)),node);par.removeChild(node);}}}}
function highlightBookSelection(){selel=document.getElementById('selcount');if(selel){var selcount=selel.value;var contentarea=getContentArea();var i;for(i=0;i<selcount;i++){nom=i.toString();term=document.edit_page['sel_'+nom].value;comm=document.getElementById('comm_'+nom);if(comm){climbPage(contentarea,term,"highlightedBookText",comm.value,"highlightedComment");}
else
climbPage(contentarea,term,"highlightedBookText",null,null);}}}
registerPloneFunction(highlightBookSelection);function HighlightSelection(txt){var contentarea=getContentArea();unhighlight(contentarea);climbPage(contentarea,txt,"bookSelection");}
function unhighlight(node){if(node.hasChildNodes){var hi_cn;for(hi_cn=0;hi_cn<node.childNodes.length;hi_cn++){unhighlight(node.childNodes[hi_cn]);}}
if(node.nodeType==3){pn=node.parentNode;if(pn.className=="bookSelection"){pn.className='';}}}
function setActiveStyleSheet(title,reset){var i,a,main;for(i=0;(a=document.getElementsByTagName("link")[i]);i++){if(a.getAttribute("rel").indexOf("style")!=-1&&a.getAttribute("title")){a.disabled=true;if(a.getAttribute("title")==title){a.disabled=false;}}}
if(reset==1){createCookie("wstyle",title,365);}}
function setStyle(){var style=readCookie("wstyle");if(style!=null){setActiveStyleSheet(style,0);}}
function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else expires="";document.cookie=name+"="+escape(value)+expires+"; path=/;";}
function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return unescape(c.substring(nameEQ.length,c.length));}
return null;}
registerPloneFunction(setStyle);function onJsCalendarDateUpdate(cal){var year=cal.params.input_id_year;var month=cal.params.input_id_month;var day=cal.params.input_id_day;var daystr=''+cal.date.getDate();if(daystr.length==1)
daystr='0'+daystr;var monthstr=''+(cal.date.getMonth()+1);if(monthstr.length==1)
monthstr='0'+monthstr;cal.params.inputField.value=''+cal.date.getFullYear()+'/'+monthstr+'/'+daystr
year.value=cal.params.inputField.value.substring(0,4);month.value=cal.params.inputField.value.substring(5,7);day.value=cal.params.inputField.value.substring(8,10);}
function showJsCalendar(input_id_anchor,input_id,input_id_year,input_id_month,input_id_day,input_id_hour,input_id_minute,yearStart,yearEnd){var input_id_anchor=document.getElementById(input_id_anchor);var input_id=document.getElementById(input_id);var input_id_year=document.getElementById(input_id_year);var input_id_month=document.getElementById(input_id_month);var input_id_day=document.getElementById(input_id_day);var format='y/mm/dd';var dateEl=input_id;var mustCreate=false;var cal=window.calendar;var params={'range':[yearStart,yearEnd],inputField:input_id,input_id_year:input_id_year,input_id_month:input_id_month,input_id_day:input_id_day};function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("mondayFirst",true);param_default("align","Bl");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");if(!window.calendar){window.calendar=cal=new Calendar(true,null,onJsCalendarDateUpdate,function(cal){cal.hide();});cal.time24=true;cal.weekNumbers=true;mustCreate=true;}else{cal.hide();}
cal.setRange(yearStart,yearEnd);cal.params=params;cal.setDateStatusHandler(null);cal.setDateFormat(format);if(mustCreate)
cal.create();cal.parseDate(dateEl.value||dateEl.innerHTML);cal.refresh();cal.showAtElement(input_id_anchor,null);return false;}
function update_date_field(field,year,month,day,hour,minute,ampm)
{var field=document.getElementById(field)
var date=document.getElementById(date)
var year=document.getElementById(year)
var month=document.getElementById(month)
var day=document.getElementById(day)
var hour=document.getElementById(hour)
var minute=document.getElementById(minute)
var ampm=document.getElementById(ampm)
if(0<year.value)
{field.value=year.value+"-"+month.value+"-"+day.value+" "+hour.value+":"+minute.value
if(ampm&&ampm.value)
field.value=field.value+" "+ampm.value}
else
{field.value=''
month.options[0].selected=1
day.options[0].selected=1
hour.options[0].selected=1
minute.options[0].selected=1
if(ampm&&ampm.options)
ampm.options[0].selected=1}}
function fullscreenMode(){if(document.getElementById('portal-top').style.display=='none'){document.getElementById('portal-top').style.display='block';document.getElementById('portal-column-one').style.display='block';document.getElementById('portal-column-two').style.display='block';}
else{document.getElementById('portal-top').style.display='none';document.getElementById('portal-column-one').style.display='none';document.getElementById('portal-column-two').style.display='none';}}
function hackPush(el){this[this.length]=el;}
function hackPop(){var N=this.length-1,el=this[N];this.length=N
return el;}
function hackShift(){var one=this[0],N=this.length;for(var i=1;i<N;i++){this[i-1]=this[i];}
this.length=N-1
return one;}
var testPushPop=new Array();if(testPushPop.push){}else{Array.prototype.push=hackPush
Array.prototype.pop=hackPop
Array.prototype.shift=hackShift;}

//ajaxian.js


function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
      @if (@_jscript_version >= 5)
      try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e) {
      try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
      xmlhttp = false;
      }
      }
      @else
      xmlhttp = false;
      @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try {
	    xmlhttp = new XMLHttpRequest();
	} catch (e) {
      xmlhttp = false;
	}
    }
  return xmlhttp;
}

var http = getHTTPObject();

function handleHttpResponse() {
    var res = '';
    if (http.readyState == 4) {
	results = http.responseText.split("****");
	if (results[1] == 'error') alert(results[2]);
	else {
	    document.getElementById(results[0]).innerHTML = results[2];
	    document.getElementById(results[3]).innerHTML = results[4];
	    document.getElementById('testingMCIField').value = results[4];
	}
    }
}

function runAjax(urla, formname, fvalue, pname) {
    pvalue = document[formname][fvalue].value;
    http.open("GET", urla + '?' + pname + '=' + pvalue, true);
    http.onreadystatechange = handleHttpResponse; http.send(null);
}
function runNotesAjax(text, w, h, t, l, uid) {
    urla = document['notesform']['urla'].value;
    objid = document['notesform']['objid'].value;
    objurl = document['notesform']['objurl'].value;
    user = document['notesform']['user'].value;
    http.open("GET", urla + '?uid=' + uid + '&w=' + w + '&h=' + h + '&t=' + t + '&l=' + l + '&objid=' + objid + '&objurl=' + objurl + '&user=' + user + '&ntext=' + text, true);
    http.onreadystatechange = handleSavedNote; http.send(null);
}
function runDelNoteAjax(uid) {
    urla = document['notesform']['delurla'].value;
    objid = document['notesform']['objid'].value;
    user = document['notesform']['user'].value;
    http.open("GET", urla + '?uid=' + uid + '&objid=' + objid + '&userid=' + user, true);
    http.onreadystatechange = handleSavedNote; http.send(null);
    
}
function runAddCommentAjax(uid, num) {
    urla = document['notesform']['addcommurla'].value;
    objid = document['notesform']['objid'].value;
    user = document['notesform']['user'].value;
    ctext = document['notesform']['ctext' + num].value;
    objurl = document['notesform']['objurl'].value;
    http.open("GET", urla + '?uid=' + uid + '&objid=' + objid + '&user=' + user + '&ctext=' + ctext + '&objurl=' + objurl, true);
    http.onreadystatechange = handleSavedNote; http.send(null);
    
}
function runDelCommentAjax(rid) {
    urla = document['notesform']['delcommurla'].value;
    objid = document['notesform']['objid'].value;
    user = document['notesform']['user'].value;
    http.open("GET", urla + '?rid=' + rid + '&objid=' + objid + '&user=' + user, true);
    http.onreadystatechange = handleSavedNote; http.send(null);
    
}
function runEditCommentAjax(rid) {
    urla = document['notesform']['edcommurla'].value;
    objid = document['notesform']['objid'].value;
    user = document['notesform']['user'].value;
    ctext = document['notesform']['edit_comm' + rid].value;
    http.open("GET", urla + '?rid=' + rid + '&objid=' + objid + '&user=' + user + '&ctext=' + ctext, true);
    http.onreadystatechange = handleSavedNote; http.send(null);
}
function handleSavedNote () {
    if (http.readyState == 4) {
	el = document.getElementById('existingNotes');
	el.innerHTML = http.responseText;
    }
}
function runSaveMetainfoAjax(urla) {
    ptitle = document.pmetainfo.ptitle.value;
    pdescr = document.pmetainfo.pdescr.value;
    pkeywords = document.pmetainfo.pkeywords.value;
    tag = document.pmetainfo.tag.value;
    http.open("GET", urla + '/ajaxSaveMetaInfo?tag=' + tag + '&ptitle=' + ptitle + '&pdescr=' + pdescr + '&pkeywords=' + pkeywords, true);
    http.onreadystatechange = handleSaveMetaInfo; http.send(null);
}

function runSaveMetainfoAjaxVlib(urla) {
    ptitle = document.pmetainfo.ptitle.value;
    pdescr = document.pmetainfo.pdescr.value;
    pkeywords = document.pmetainfo.pkeywords.value;
    req = document.pmetainfo.req.value;
    http.open("GET", urla + '/ajaxSaveMetaInfo?req=' + req + '&ptitle=' + ptitle + '&pdescr=' + pdescr + '&pkeywords=' + pkeywords, true);
    http.onreadystatechange = handleSaveMetaInfo; http.send(null);
}


function handleAjaxQuery() {
    if (http.readyState == 4) {
	el = document.getElementById('searchImagesResult');
	el.innerHTML = http.responseText;
	urla = document.getElementById('purl');
	loadImages(urla, 'phtitlez', 'luids', 'auids');
    }
}
function runSearchImagesAjax(urla) {
    gtype = document.ajaximgsearch.gtype.value;
    cl1 = document.ajaximgsearch.clrs1.value;
    cl2 = document.ajaximgsearch.clrs2.value;
    el = document.getElementById('searchImagesResult');
    el.innerHTML = '';
    http.open("GET", urla + '/ajaxSearchImages?gtype=' + gtype + '&cl1=' + cl1 + '&cl2=' + cl2, true);
    http.onreadystatechange = handleAjaxQuery; http.send(null);
}
function runSearchImagesAjax1(urla) {
    gtype = document.ajaximgsearch.gtype.value;
    cl1 = document.ajaximgsearch.clrs1.value;
    cl2 = document.ajaximgsearch.clrs2.value;
    el = document.getElementById('searchImagesResult');
    el.innerHTML = '<div style=\"padding-top: 15em;\"><img src=\"loading.gif\" border=0/>&nbsp;Loading...</div>';
    var phrase_el = document.getElementById('phrase');
    var searchtext = document.getElementById('SearchableText');
    var phrase = '&phrase=' + phrase_el.value + '&SearchableText=' + searchtext.value;
    http.open("GET", urla + '/ajaxSearchImages1?gtype=' + gtype + '&cl1=' + cl1 + '&cl2=' + cl2 + phrase, true);
    http.onreadystatechange = handleAjaxQuery; http.send(null);
}
// LikeList
function handleLikeListQuery() {
    if (http.readyState == 4) {
	el = document.getElementById('farlangLikeList');
	el.innerHTML = http.responseText;
    }
}
function ajaxAddToLikeList(uid) {
    oldc = getCookie('farlangLikeList');
    if (oldc) {
	setCookie('farlangLikeList', oldc + '**' + uid);
	ll = oldc + '**' + uid;}
    else {
	setCookie('farlangLikeList', uid);
	ll = uid;}
    http.open("GET", urla + '/ajaxAddToLikeList?likelist=' + ll, true);
    http.onreadystatechange = handleLikeListQuery; http.send(null);
}
function ajaxAddToLikeList1(uid) {
    oldc = getCookie('todoimagelist');
    if (oldc) {
	setCookie('todoimagelist', uid + '**' + oldc);
	ll = oldc + '**' + uid;}
    else {
	setCookie('todoimagelist', uid);
	ll = uid;}
    var form = document.getElementById('favorites_form');
    var req_url = urla + '/ajaxTodoImageList?likelist=' + ll + '&uid=' + uid;
    if (form && form.objuser) req_url += '&objuser=' + form.objuser.value;
    if (form && form.fav_option) req_url += '&fav_option=' + form.fav_option.value;
    if (form && form.user_title) req_url += '&user_title=' + form.user_title.value;
    if (form && form.user_comment) req_url += '&user_comment=' + form.user_comment.value;
    http.open("GET", req_url, true);
    http.onreadystatechange = handleTodoListQuery; http.send(null); 
}
function handleTodoListQuery() {
    if (http.readyState == 4) {
	el = document.getElementById('todoListList');
	el.innerHTML = http.responseText;
    }
}
function handleSaveMetaInfo() {
}
function runClickPlaylistTabAjax(urla) {
    http.open("GET", urla, true);
    http.onreadystatechange = handleClickPlaylistTab; http.send(null);
}
function handleClickPlaylistTab() {
    if (http.readyState == 4){
      var playlist = document.getElementById('playlist_area');
      playlist.innerHTML = http.responseText;
    }
}
function setTabs() {
  var argv = setTabs.arguments;
  var argc = argv.length;
  for (var i = 1; i < argc; i++) {
    el = document.getElementById(argv[i]);
    el.style.display = "none";
  }
  el = document.getElementById(argv[0]);
  el.style.display = "block";
}
function clickColor(ename, cname, color) {
    el = document.getElementById(ename);
    el.style.background = color;
    cl = document.getElementById(cname);
    cl.value = color;
}

//**** cookie functions
function getCookie(name) {
  var start = document.cookie.indexOf(name+"=");
  var len = start+name.length+1;
  if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
  if (start == -1) return null;
  var end = document.cookie.indexOf(";",len);
  if (end == -1) end = document.cookie.length;
  return unescape(document.cookie.substring(len,end));}
function setCookie(cookieName, cookieValue, nDays, domain) {
  var today = new Date();
  var expire = new Date();
  var cookietext = '';
  if (nDays == null || nDays == 0) nDays=362;
  expire.setTime(today.getTime() + 3600000*24*nDays);
  if (domain == null || domain == eval('')) {
    cookietext = cookieName + "=" + escape(cookieValue) + ";path=/;expires=" + expire.toGMTString();}
  else {
    cookietext = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString() + ";path=/;domain=" + domain;};
  document.cookie = cookietext;}


//desbase.js

var s2;
function switchDisplay(iid, bid, purl){
    el1 = document.getElementById(iid);
    el2 = document.getElementById(bid);
    if (el1.src == purl + '/dsimgs/bt_open_cat_sm.jpg'){
	el2.style.display = 'block';
	el1.src = purl + '/dsimgs/bt_close_cat_sm.jpg';
    }
    else {
	el2.style.display = 'none';
	el1.src = purl + '/dsimgs/bt_open_cat_sm.jpg';
    }
}

function switchDisplayDesigner(iid, bid, purl){
    el1 = document.getElementById(iid);
    el2 = document.getElementById(bid);
   
    if (el1.src == purl + '/images/designer_page/portfolio.jpg'){
	
       // el2.style.display = 'block';
        Effect.toggle(bid, 'appear'); 
	el1.src = purl + '/images/designer_page/portfolio_close.jpg';
    }
    else {
	el2.style.display = 'none';
	el1.src = purl + '/images/designer_page/portfolio.jpg';
    }
}

function setTabs() {
    var argv = setTabs.arguments;
    var argc = argv.length;
    for (var i = 1; i < argc; i++) {
	el = document.getElementById(argv[i]);
	el.style.display = "none";
    }
    el = document.getElementById(argv[0]);
    el.style.display = "block";
}
var currentVolume;
function sendEvent(typ,prm) {
    thisMovie("mpl").sendEvent(typ,prm);
};
function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
	return window[movieName];}
    else {
	return document[movieName];}
};
function getUpdate(typ,pr1,pr2,pid) {
    if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100);}
    else if(typ == "volume") { currentVolume = pr1; }
};
function getItemList(idx) {
    var obj = thisMovie("mpl").itemData(idx);
    var nodes = "";
    for(var i in obj) { 
	var first = "" + "<li>";
	var second = "" + "<\/li>";
	nodes += first + i + ': ' + obj[i] + second; 
    };
    document.getElementById("data").innerHTML = nodes;
};
function getItemData(idx) {
    var obj = thisMovie("mpl").itemData(idx);
    el = document.getElementById("currPlayedTitle");
    if (thisMovie("mpl").itemData(idx)['title'])
        el.innerHTML = thisMovie("mpl").itemData(idx)['title'];
    else
        el.innerHTML = "";
};
function switchPlState(nm, url) {
    el = document.getElementById(nm);
    if (el.src == url + '/buttons/b_stop_off.gif') {
	el.src = url + '/buttons/b_play_off.gif';}
    else {
	el.src = url + '/buttons/b_stop_off.gif';}
}
var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);

  function fixPNG(myImage) {

   var arVersion = navigator.appVersion.split("MSIE");
   var version = parseFloat(arVersion[1]);

   if ((version >= 4) && (version < 7) && (document.body.filters)) {
	
        var imgID = (myImage.id) ? "id='" + myImage.id + "' " : "";
	var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "";
	var imgTitle = (myImage.title) ? "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' ";
	var imgStyle = "display:inline-block;" + myImage.style.cssText;
	var strNewHTML = "<span " + imgID + imgClass + imgTitle
	    + " style=\"cursor:pointer;" + "width:" + myImage.width 
	    + "px; height:" + myImage.height 
	    + "px;" + imgStyle + ";"
	    + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	    + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>";
	myImage.outerHTML = strNewHTML;
    }
}

// Scrolling javascripts
var pages = 0;
var pagee = 50;
var iens6 = document.all||document.getElementById;
var ns4 = document.layers;
var speed=4;
function movedown(){
    ch = document.flashvars.ch.value;
    if (window.moveupvar) clearTimeout(moveupvar);
    if (parseInt(crossobj.style.top) >= (ch*(-1)+100)) {
	crossobj.style.top = parseInt(crossobj.style.top) - speed+"px";
    }
    movedownvar = setTimeout("movedown()", 20);
    if (pages == pagee) {
	stopscroll();
    }
    else {
	pages = pages + 1;
}
}
function moveup(){
    if (window.movedownvar) clearTimeout(movedownvar);
    if (iens6&&parseInt(crossobj.style.top)<=0)
	crossobj.style.top=parseInt(crossobj.style.top)+speed+"px";
    else if (ns4&&crossobj.top<=0)
	crossobj.top+=speed;
    moveupvar=setTimeout("moveup()",20);
    if (pages == pagee) {
	stopscroll();
    }
    else {
	pages = pages + 1;
    }
}
function stopscroll(){
    if (window.moveupvar) clearTimeout(moveupvar);
    if (window.movedownvar) clearTimeout(movedownvar);
}
function movetop(){
    stopscroll()
	if (iens6)
	    crossobj.style.top=0+"px";
	else if (ns4)
	    crossobj.top=0;
}
function getcontent_height(){
    var contentheight = crossobj.offsetHeight;
    document.flashvars.ch.value = contentheight;
}
//// second control
function movedown1(){
    ch = document.flashvars.ch1.value;
    if (window.moveupvar) clearTimeout(moveupvar);
    if (parseInt(crossobj1.style.top) >= (ch*(-1)+100)) {
	crossobj1.style.top = parseInt(crossobj1.style.top) - speed+"px";
    }
    movedownvar = setTimeout("movedown1()", 20);
    if (pages == pagee) {
	stopscroll1();
    }
    else {
	pages = pages + 1;
}
}
function moveup1(){
    ch = document.flashvars.ch1.value;
    if (window.movedownvar) clearTimeout(movedownvar);
    if (parseInt(crossobj1.style.top)<=0)
	crossobj1.style.top=parseInt(crossobj1.style.top)+speed+"px";
    moveupvar=setTimeout("moveup1()",20);
    if (pages == pagee) {
	stopscroll1();
    }
    else {
	pages = pages + 1;
    }
}
function stopscroll1(){
    if (window.moveupvar) clearTimeout(moveupvar);
    if (window.movedownvar) clearTimeout(movedownvar);
}
function movetop1(){
    stopscroll1();
    if (iens6)
	crossobj1.style.top=0+"px";
    else if (ns4)
	crossobj1.top=0;
}
function getcontent_height1(){
    var contentheight = crossobj1.offsetHeight;
    document.flashvars.ch1.value = contentheight;
}
///////

 function clickLogin(options)
      {
          if (!options) options = {};
          jQuery.get(curr_url, options, function(data){
              Shadowbox.open({type:'html',content:data,title:'Log in or Sign Up',width:930,height:400});
          });
          return false;
      }
      function loginRegisterEvent(data){
          var result = data.split("|");
          if (result && result[0]=="success")
          {
              window.location = result[1];
              Shadowbox.close();
          }
          else
          {
              var msg = result && result[1] ? result[1] : "Some error occured";
              jQuery("#jquerySystemMessage").toggleClass("systemMessage");
              jQuery("#jquerySystemMessage").html(msg);
          }
      }
      function submitLoginForm()
      {
          jQuery("#jquerySystemMessage").html("");
          jQuery("#jquerySystemMessage").removeClass();
          jQuery("form[name=popup_auth_form]").ajaxSubmit({
              url : 'logged_in_ajax',
              success : loginRegisterEvent
          });
          return false;
      }
      function submitRegisterForm()
      {
          jQuery("#jquerySystemMessage").html("");
          jQuery("#jquerySystemMessage").removeClass();
          jQuery("form[name=popup_auth_form]").ajaxSubmit({
              url : 'register_ajax',
              success : loginRegisterEvent
          });
          return false;
      }
      jQuery(document).ready(function(){
          Shadowbox.init({skipSetup:true,overlayOpacity:0.7,overlayColor:'#333',keysClose:[27]});

          jQuery("a#login_register_link").click(function() {
              jQuery.get("/popup_auth?topright=1", {}, function(data){
                 Shadowbox.open({type:'html',content:data,title:'Log in or Sign Up',width:930,height:400});
              });
              return false;
          });



          jQuery("a#login_register_button").click(clickLogin);
      });
      function checkUsername(){
          var u = jQuery("#register_username").val();
          var uav = jQuery("#username_availability");
          uav.html("<img src=\"loading_bar.gif\">&nbsp;Loading...");
          jQuery.get("check_username", {username: u}, function(data){
              uav.html(data);
          });
      }
      var strength_r = [/^\w{1,6}$/, /^(?=.*\w)(?=.*\W).{1,6}$/, /^(?=.*\w).{7,}$/, /^(?=.*\w)(?=.*\W).{7,}$/];
      var strength = ["Low", "Medium", "Medium", "High"];
      function checkPasswordStrength(input){
          var s = "Password Strength: ";
          var index = ""
          for (var i=strength_r.length - 1; i>=0; i--)
          {
              var r = strength_r[i];
              if (input.value.match(r))
              {
                 s += strength[i];
                 break;
              }
          }
          jQuery('#password_strength').html(s);
      }

jQuery(document).ready(function() {
       jQuery("#register_username").keydown(function (e) {
          if(e.keyCode == 32) e.preventDefault();
      });
       initGemstonesAutocomplete();
         initDefaultSearchText();
     //  sectionChanged();
   
});


     var megaConfig = {
         interval: 50,
         sensitivity: 4,
         over: addMega,
         timeout: 50,
         out: removeMega,
       };
jQuery(function() {
       jQuery("li.mega").hoverIntent(megaConfig);
          });  


      function addMega(){
          jQuery(this).addClass("hovering");
       }

       function removeMega(){
           jQuery(this).removeClass("hovering");
       }

            function initGemstonesAutocomplete()
            {
                // Create autocomplete
                jQuery("#searchtext").autocomplete(getTopAutocomplete, {
                        delay: 0,
                        width: 200,
                        multiple: true,
                        selectFirst: false,
                        mustMatch: false,
                        multipleSeparator: " ",
                        scroll: true,
                        scrollHeight: 200
                });
            }
            
            function initDefaultSearchText()
            {
                jQuery("#searchtext").focus(function(){
                    if(this.value == "search products or information")
                        this.value="";
                });
                jQuery("#searchtext").blur(function(){
                    if(this.value == "")
                        this.value="search products or information";
                });
            }
            
            function sectionChanged()
            {    
                var section = jQuery('input[@name=search_section]').val();
                if (section == 'catalog')
                {
                    jQuery('form[@name=search_form]').attr("action","/catalog-search");

                }
                else if (section == 'education')
                {
                    jQuery('form[@name=search_form]').attr("action","/education-center");            
 
                }
                else if (section == 'all')
                {
                    jQuery('form[@name=search_form]').attr("action","/all-sections");            
 
                }
                else
                {
                    jQuery('form[@name=search_form]').attr("action","/catalog-search"); 
 
                }
            }


//***** Base cookie functions *****
function getCookie(name) {
  var start = document.cookie.indexOf(name+"=");
  var len = start+name.length+1;
  if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
  if (start == -1) return null;
  var end = document.cookie.indexOf(";",len);
  if (end == -1) end = document.cookie.length;
  return unescape(document.cookie.substring(len,end));}

function setCookie(cookieName, cookieValue, nDays, domain) {
  var today = new Date();
  var expire = new Date();
  var cookietext = '';
  if (nDays == null || nDays == 0) nDays=362;
  expire.setTime(today.getTime() + 3600000*24*nDays);
  if (domain == null || domain == eval('')) {
    cookietext = cookieName + "=" + escape(cookieValue) + ";path=/;expires=" + expire.toGMTString();}
  else {
    cookietext = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString() + ";path=/;domain=" + domain;};
  document.cookie = cookietext;}

function deleteCookie(name, path, domain) {
  var cstr = '';
  if (getCookie(name)) {
    sctr = name + "=" + ( (path) ? ";path=" + path : "") + ( (domain) ? ";domain=" + domain : "") +  ";expires=Thu, 01-Jan-70 00:00:01 GMT";
    document.cookie = cstr;};}

//***** Calculate screen resolution *****
function getScreenResolution() {
  setCookie('scr_width', screen.width);
  setCookie('scr_height', screen.height);
  //alert('Width: ' + screen.width + '. Height: ' + screen.height);
}
 

function showObject(objname) {
  obj = document.getElementById(objname);
  if (obj)
    obj.className = "FarlangUserMenu";}

function hideObject(objname)
{
  obj = document.getElementById(objname);
  if (obj)
    obj.className = "FarlangUserMenuHidden";
}

var today = new Date();
var zero_date = new Date(0,0,0);
today.setTime(today.getTime() - zero_date.getTime());
var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000));

function setVisitorID() {
  if (getCookie('VisitorID')) {
    var VisitorID = getCookie('VisitorID');
  }else{
    setCookie('VisitorID', Math.random());
  }
}

function toggleCookie(cName, cPath, domain) {
  var oldCookie = getCookie(cName);
  if (eval(oldCookie) == eval(1)){
    setCookie(cName, '0', 0, domain);
  };
  if (eval(oldCookie) == eval(0)){
    setCookie(cName, '1', 0, domain);
  };
  if (eval(oldCookie) == null){
    setCookie(cName, '1', 0, domain);
  };
}

function setSessionID() {
  if (!getCookie('SessionID'))
    getCookie('SessionID',Math.random());
} 

function setDisplay(name, val){
  elem = document.getElementById(name);
  elem.style.display = val;
}
function setThisDisplay(elem, val){
  elem.style.display = val;
}
function setMenuForIE() {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("actionFarlangUserMenu");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
	node.onmouseover=function() {
	  elem = document.getElementById('actionFarlangUserMenu');
	  elem.style.display = 'block';
	}
	node.onmouseout=function() {
	  elem = document.getElementById('actionFarlangUserMenu');
	  elem.style.display = 'none';
	}
      }
    }
  }
}
function setLabel(name, val) {
  elem = document.getElementById(name);
  elem.innerHTML = val;
}

function setVisibility(name, val){
  elem = document.getElementById(name);
  elem.style.visibility = val;
}

function toggle_label(el, first, second){
  if (el.innerHTML == first){
    el.innerHTML = second;
  }
  else if (el.innerHTML == second){
    el.innerHTML = first;
  }
}
function toggle_value(el, first, second) {
  if (el.value == first)
    el.value = second;
  else
    el.value = first;
}

function toggle_display(elname) {
  var el = document.getElementById(elname);
  if (el.style.display == '' || el.style.display == 'block'){
    el.style.display = "none";
  }
  else {
    el.style.display = "block";
  };
}
function toggle_tab(coname, elname) {
  var el = document.getElementById(elname + '-body');
  alert(getCookie(elname + '-tab'));
  alert(coname);
  if (getCookie(elname + '-tab') != coname) {
    el.display == 'block';
    setCookie(elname + '-body', '1');}
  else {
    if (parseInt(getCookie(elname + '-body')) == 1) {
      el.style.display = 'none';
      setCookie(elname + '-body', '0');}
    else {
      el.style.display = 'block';
      setCookie(elname + '-body', '1');}}
}
function toggle_box_src(elname, imgname, urla) {
  var el = document.getElementById(elname);
  if (el.style.display == '' || el.style.display == 'block'){
    document[imgname].src = urla + '/box_down.gif';
  }
  else {
    document[imgname].src = urla + '/box_up.gif';
  };
}
function toggleSlidingPanel(){
  var el = document.getElementById('SlidingPanelLink');
  if (el)
    if (el.innerHTML == 'Open side panel') {
      Effect.toggle('slidingPanelColumn', 'appear');
      el.innerHTML = 'Close side panel';
    }}
function showSlidingPanel(){
  Effect.toggle('slidingPanelColumn', 'appear');
}
function hidePortlets() {
  portlets = new Array('minimizeSlidingPanel', 'minBookToolsPortlet', 'minBookPortlet', 'portlet-search-photos', 'portlet-add-content', 'portlet-navigation', 'portlet-photo-tools', 'portlet-wiki', 'portlet-book-tools', 'portlet-login', 'portlet-join');
  for (var i = 0; i < portlets.length; i++) {
    elem = document.getElementById(portlets[i]);
    if (elem)
      elem.style.display = 'none'
	}
}
function setDisplayPortlets(value) {
  log_portlets = new Array('portlet-login', 'portlet-join', 'minLogRegPortlets');
  portlets = new Array('minBookPortlet', 'minBookToolsPortlet', 'portlet-search-photos', 'portlet-add-content', 'portlet-navigation', 'portlet-photo-tools', 'portlet-wiki', 'portlet-book-tools');
  var el = document.getElementById('SlidingPanelLink');
  if (el.value == 'Close Side Panel') {
    if (value == 'display') {
      for (var i = 0; i < log_portlets.length; i++) {
	elem = document.getElementById(log_portlets[i]);
	if (elem) {
	  elem.style.display = 'none'
	    }}
      for (var i = 0; i < portlets.length; i++) {
	elem = document.getElementById(portlets[i]);
	if (elem) {
	  elem.style.display = 'block'
	    }}}}
  if (value == 'hide') {
    for (var i = 0; i < log_portlets.length; i++) {
      elem = document.getElementById(log_portlets[i]);
      if (elem) {
	elem.style.display = 'block'
	  }}
    for (var i = 0; i < portlets.length; i++) {
      elem = document.getElementById(portlets[i]);
      if (elem != null) {
	elem.style.display = 'none';
      }}}}
function switchDisplayPortlets() {
  var argv = switchDisplayPortlets.arguments;
  var argc = argv.length;
  for (var i = 2; i < argc; i++) {
    var el = document.getElementById(argv[i]);
    if (el != null) {
      el.style.display = "none";
      setCookie(argv[i], '0', 0, argv[0]);
    };
  }
  var el = document.getElementById(argv[1]);
  el.style.display = "block";
  setCookie(argv[1], '0', 1, argv[0]);
}
function setContentBarWidth() {
  var el = document.getElementById('contentBar');
  elWide = document.getElementById('contentBarWide');
  if (parseInt(screen.width) <= parseInt(1024)) {
    if (el != null) {el.style.width = "700px";};
    if (elWide != null) {el.style.width = "650px";};
  }
  else {
    if (parseInt(screen.width) >= 1600) {
      if (el != null) {el.style.width = "1350px"};}
    else {
      if (el != null) {el.style.width = "850px"};};
  };
}
function pasteValue(formname, inputname, value, elname) {
  document.forms[formname][inputname].value = value;
  var el = document.getElementById(elname);
  el.style.display = "none";
}
function setTabs() {
  var argv = setTabs.arguments;
  var argc = argv.length;
  for (var i = 1; i < argc; i++) {
    var el = document.getElementById(argv[i]);
    el.style.display = "none";
  }
  el = document.getElementById(argv[0]);
  el.style.display = "block";
}
function setTabsClass() {
  var argv = setTabsClass.arguments;
  var argc = argv.length;
  for (var i = 1; i < argc; i++) {
    var el = document.getElementById(argv[i]);
    if (el != null) {
      el.className = "portletTab";
    };
  }
  var el = document.getElementById(argv[0]);
  el.className = "portletTab active";
}
function setSelectedClass() {
  var argv = setSelectedClass.arguments;
  var argc = argv.length;
  for (var i = 1; i < argc; i++) {
    var el = document.getElementById(argv[i]);
    if (el != null) {
      el.className = "";
    };
  }
  var el = document.getElementById(argv[0]);
  el.className = "selected";
}
function setDisplayPages(ind, qty) {
  for (var i = 0; i < qty; i++) {
    var el = document.getElementById('chapters_' + i.toString());
    elchap = document.getElementById('chaplink_' + i.toString());
    if (el != null) {
      if (i == parseInt(ind)) {
	el.style.display = 'block';
	elchap.className = "active";
      }
      else {
	el.style.display = 'none';
	elchap.className = "";
	  };
    }
  }
}
function setTextLinkAttrs(lnk, domain) {
  text_size = getCookie('text_size');
  if (text_size == null) {
    text_size = 'normal';
  };
  el_minus = document.getElementById('text-minus');
  el_plus = document.getElementById('text-plus');
  if (lnk.id == 'text-minus'){
    if (text_size == 'normal') {
      el_minus.style.visibility = 'hidden';
      el_plus.style.visibility = 'visible';
      setActiveStyleSheet('Small Text', 1);
      setCookie('text_size', 'small', 0, domain);
    };
    if (text_size == 'large') {
      el_minus.style.visibility = 'visible';
      el_plus.style.visibility = 'visible';
      setActiveStyleSheet('', 1);
      setCookie('text_size', 'normal', 0, domain);
    };
    if (text_size == 'huge') {
      el_minus.style.visibility = 'visible';
      el_plus.style.visibility = 'visible';
      setActiveStyleSheet('Large Text', 1);
      setCookie('text_size', 'large', 0, domain);
    };
    if (text_size == 'super') {
      el_minus.style.visibility = 'visible';
      el_plus.style.visibility = 'visible';
      setActiveStyleSheet('Huge Text', 1);
      setCookie('text_size', 'huge', 0, domain);
 };
  };
  if (lnk.id == 'text-plus'){
    if (text_size == 'small') {
      el_minus.style.visibility = 'visible';
      el_plus.style.visibility = 'visible';
      setActiveStyleSheet('', 1);
      setCookie('text_size', 'normal', 0, domain);
    };
    if (text_size == 'normal') {
      el_minus.style.visibility = 'visible';
      el_plus.style.visibility = 'visible';
      setActiveStyleSheet('Large Text', 1);
      setCookie('text_size', 'large', 0, domain);
    };
    if (text_size == 'large') {
      el_minus.style.visibility = 'visible';
      el_plus.style.visibility = 'visible';
      setActiveStyleSheet('Huge Text', 1);
      setCookie('text_size', 'huge', 0, domain);
    };
    if (text_size == 'huge') {
      el_minus.style.visibility = 'visible';
      el_plus.style.visibility = 'hidden';
      setActiveStyleSheet('Super Text', 1);
      setCookie('text_size', 'super', 0, domain);
    };
  };
}
function setBoldTabs() {
  var argv = setBoldTabs.arguments;
  var argc = argv.length;
  for (var i = 1; i < argc; i++) {
    var el = document.getElementById(argv[i]);
    if (el != null) {
      //el.style.fontWeight = "normal";
      el.style.color = "#ffffff";
    };
  }
  var el = document.getElementById(argv[0]);
  //el.style.fontWeight = "bold";
  el.style.color = "#0094fc";
  inputel = document.getElementById('main_search_tab');
  inputel.value = argv[0]
}
function setEditPhoto(form, objid, gtype, gtitle, gdescr, gsize_length, gsize_width, gsize_height, gmeasure, gmetal, gnumber, gcarat, gcolor, gstyle, gproddate, gtitleline) {
//  var gtypes = new Array('loose stone', 'necklace', 'ring', 'bracelet', 'pendant', 'carving', 'intaglia', 'earrings', 'watch', 'brooch')
  document.edit_photo_form.photo_editing.value = objid;
  document.edit_photo_form.gtype.selectedIndex = gtype;
  document.edit_photo_form.photo_title.value = gtitle;
  document.edit_photo_form.photo_descr.value = gdescr;
  document.edit_photo_form.gsize_length.value = gsize_length;
  document.edit_photo_form.gsize_width.value = gsize_width;
  document.edit_photo_form.gsize_height.value = gsize_height;
//  document.edit_photo_form.gsize_measure.value = gmeasure;
  document.edit_photo_form.gmetal.value = gmetal;
  document.edit_photo_form.gnumber.value = gnumber;
  document.edit_photo_form.gcarat.value = gcarat;
  document.edit_photo_form.gcolor.value = gcolor;
  document.edit_photo_form.gstyle.value = gstyle;
  document.edit_photo_form.gproddate.value = gproddate;
  document.edit_photo_form.gtitleline.value = gtitleline;
  photoblock = document.getElementById('edit_photo_block');
  photoblock.style.display = 'block';
  fileblock = document.getElementById('upload_photo_block');
  fileblock.style.display = 'none';
}
function toggleUserMenu(){
  var el = document.getElementById('actionFarlangUserMenu');
  if (el.style.display == 'none') {
    new Effect.BlindDown('actionFarlangUserMenu');}
  else {
    new Effect.BlindUp('actionFarlangUserMenu');}
}

function switchZooming(el, domain){
  toolbar = document.getElementById('magTools');
  if (el.innerHTML == 'switch loupe ON'){
    el.innerHTML = 'switch loupe OFF';
    el.style.color = '#ff0000';
    setCookie('zoom_state', '1', 0);
    toolbar.style.display = 'block';
  }
  else if (el.innerHTML == 'switch loupe OFF'){
    el.innerHTML = 'switch loupe ON';
    el.style.color = '#007f00';
    setCookie('zoom_state', '0', 0);
    toolbar.style.display = 'none';
  }
}

function startList() {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("nav");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
	node.onmouseover=function() {
	  this.className+=" over";
	}
	node.onmouseout=function() {
	  this.className=this.className.replace(" over", "");
	}
      }
    }
  }
}
function setOpenClose(op, elen, url) {
    opimg = document.getElementById('switchicon_' + op);
    opimg.src = url + '/box_hide.gif';
    opbl = document.getElementById('menublock_' + op);
    opbl.style.display = 'block';
    for (var i = 0; i < elen; i++) {
	if (i != op) {
	    climg = document.getElementById('switchicon_' + i);
	    climg.src = url + '/box_show.gif';
	    clbl = document.getElementById('menublock_' + i);
	    clbl.style.display = 'none';
	}
    }
}

function setProps(name, val, displ, url, fname) {
  swlink = document.getElementById('switcher_' + name);
  swimg = document.getElementById('switchicon_' + name);
  //alert("setProps('" + name + "', '" + val + "', '" + displ + "', '" + url + "', '" + fname + "');");
  if (val == '0')
    nval = '1';
  else
    nval = '0';
  if (displ == 'none'){
    ndispl = 'block';}
  else
    ndispl = 'none';
  if (fname == 'box_hide.gif')
    nfname = 'box_show.gif';
  else
    nfname = 'box_hide.gif';
  swlink.onclick = Function("setCookie('menublock_" + name + "', '" +  nval + "'); setDisplay('menublock_" + name + "', '" + ndispl + "'); setProps('" + name + "', '" + nval + "', '" + ndispl + "', '" + url + "', '" + nfname + "'); return false;");
  //alert(swlink.onclick);
  swimg.src = url + '/' + fname;
}

function setPropsCont(name, val, displ, url, fname) {
  swlink = document.getElementById('switcher_' + name);
  swimg = document.getElementById('switchicon_' + name);
  if (val == '0')
    nval = '1';
  else
    nval = '0';
  if (displ == 'none'){
    ndispl = 'block';}
  else
    ndispl = 'none';
  if (fname == 'box_hide.gif')
    nfname = 'box_show.gif';
  else
    nfname = 'box_hide.gif';
  swlink.onclick = Function("setCookie('cpagebl_" + name + "', '" +  nval + "'); setDisplay('cpagebl_" + name + "', '" + ndispl + "'); setPropsCont('" + name + "', '" + nval + "', '" + ndispl + "', '" + url + "', '" + nfname + "'); return false;");
  swimg.src = url + '/' + fname;
}

function addValue(el, val) {
    obj = document.getElementById(el);
    ln = document.getElementById('link_' + val);
    oldval = obj.value;
    obj.value = oldval + '||' + val;
    ln.href = "javascript:removeValue('" + el + "', '" + val + "'); setHtml('link_" + val + "', 'Add to slideshow');"}
function removeValue(el, val) {
    var obj = document.getElementById(el);
    ln = document.getElementById('link_' + val);
    oldval = obj.value;
    obj.value = oldval.replace('||' + val, '');
    ln.href = "javascript:addValue('" + el + "', '" + val + "'); setHtml('link_" + val + "', 'Remove from slideshow');"}
function setHtml(el, text) {
    var obj = document.getElementById(el);
    obj.innerHTML = text;}

function setTinyVisible(name) {
    var obj = document.getElementById(name);
    if (obj) {
	obj.style.visibility = 'visible';
	obj.style.width = '100%';
	obj.style.height = '100%';}}

function createInputs() {
    var el1 = document.getElementById('regpass');
    var el2 = document.getElementById('regreppass');
    var el3 = document.getElementById('logpass');
    el1.innerHTML = '<input type="password" name="password" size="13" />';
    el2.innerHTML = '<input type="password" name="password_confirm" size="13" />';
    el3.innerHTML = '';}
function destroyInputs() {
    var el1 = document.getElementById('regpass');
    var el2 = document.getElementById('regreppass');
    var el3 = document.getElementById('logpass');
    el1.innerHTML = '';
    el2.innerHTML = '';
    el3.innerHTML = '<input type="password" size="13" name="__ac_password" tal:attributes="tabindex tabindex/next;" />';}

function recreatePlayer(purl, rotatetime) {
    var s2 = new SWFObject('/mediaplayer/imagerotator.swf','mpl','254','178','7');
    s2.addVariable('file', purl + '/playlist.xml');
    s2.addVariable("rotatetime",rotatetime);
    s2.addVariable("transition","fade");
    s2.addVariable("shownavigation","false");
    s2.addVariable("shuffle","false");
    s2.addVariable("autostart","true");
    s2.addVariable("overstretch","false");
    s2.addVariable("enablejs","true");
    s2.addVariable("linkfromdisplay","true");
    s2.addVariable("javascriptid","mpl");
    s2.addVariable("screencolor","0x535554");
    s2.addVariable("showicons","false");
    s2.write("player2");
}
 
