﻿// JScript File
var menuLastLink = "";
function MenuNav() {
    window.location = menuLastLink;
}
//function MenuNavIn(x, h) {
//  window.status=h;
//  menuLastLink = h;

//  if (x.className == 'TdMenuStatic') return;
//  x.className='TdMenuHighlight';  
//}

function MenuNavIn(x) {
  //parses the td element to find <a> tag
  //good for IE7 and FireFox2
  //
  //td id="ctl00_TD1" class="normal" onclick="MenuNav()" onmouseover="MenuNavIn(this)" onmouseout="MenuNavOut(this)">
  //                                  <span id="ctl00_Label40" style="color:White;background-color:#A40006;">  </span>
  //                    <a id="ctl00_HyperLink1"
  //
  //x = td   -> .firstChild = text  -> .nextSibling = span  -> .nextSibling = text  -> .nextSibling = <a>

  //h = x.firstChild.nextSibling.nextSibling.nextSibling;
  
  var h = x.firstChild.nextSibling.nextSibling; //FF
  if (h.tagName != "A") 
      h = h.nextSibling;  //IE requires one more level
  
  //ff h = x.firstChild.nextSibling.nextSibling.nextSibling;
  //ie h = x.firstChild.nextSibling.nextSibling;
  //alert(h.className); //alert(h.tagName);
  window.status=h;
  
  //tagName
  //nodeName

  menuLastLink = h;

  if (x.className == 'TdMenuStatic') return;
  x.className = 'TdMenuHighlight';  
}

function MenuNavOut(x) {
  if (x.className == 'TdMenuStatic') return;

  x.className = 'TdMenuNormal'; 
  window.status='';
}

function StartNewTopic(i) {
  var x = document.getElementById("ctl00_ContentPlaceHolder1_table_new_message");  
  if (i==1) 
    x.style.display='';
   else
    x.style.display='none';
    
  x = document.getElementById("ctl00_ContentPlaceHolder1_HyperLink3");
  if (i==1)
    x.style.display='none';
   else
    x.style.display='';   
}

function StartNewMessage(i) {
  var x = document.getElementById("ctl00_ContentPlaceHolder1_table_topic_message");
  if (i==1) 
    x.style.display='';
   else
    x.style.display='none';
        
  x = document.getElementById("ctl00_ContentPlaceHolder1_HyperLink3");
  if (i==1)
    x.style.display='none';
   else
    x.style.display='';   
}

function getObjLeft(myObject) {
  //return(myObject.offsetParent ? (getObjLeft(myObject.offsetParent) + myObject.offsetLeft) : myObject.offsetLeft);
  return getXY(myObject).x;
}

function getObjTop(myObject) {
  //return(myObject.offsetParent ? (getObjTop(myObject.offsetParent) + myObject.offsetTop) : myObject.offsetTop);
  return getXY(myObject).y;
}


//----------------------------------------------------
// stars / rating
//----------------------------------------------------
var stars_timeoutid = 0;
var name1_for_hide = '';
var active_textbox;
var clicked = 0;
var active_ratingcontrol;
function SetStars(count1, name1) {
    if (clicked) return;
    SetStars_ClearTimer();    
    
    name1 = name1.replace('Image1', 'Image');
    name1 = name1.replace('Image2', 'Image');
    name1 = name1.replace('Image3', 'Image');
    name1 = name1.replace('Image4', 'Image');
    name1 = name1.replace('Image5', 'Image');

    active_ratingcontrol = name1.replace("Image", "");
    //alert(active_ratingcontrol);
  
  for (i = 1; i <= count1; i++) {
    //WebUserControl1_Image1
    img = document.getElementById(name1 + i);  //WebUserControl1_Image1 
    img.src = '/images/rating-on.png';
  }

  for (i = count1+1; i <= 5; i++) {
    //WebUserControl1_Image1
    img = document.getElementById(name1 + i);  //WebUserControl1_Image1  
    img.src = '/images/rating-off.png';
  }

  //ctl00$ContentPlaceHolder1$Control_Rating1$TextBox1
  var name2 = name1.replace("Image", "TextBox1");
  //alert(name2);
  var txb = document.getElementById(name2);  //WebUserControl1_Image1
  //alert(txb);
  //txb.value = count1;
  active_textbox = txb;
}

function Late_SetStars0(name1) {    
    name1_for_hide = name1;
    stars_timeoutid = setTimeout('HideStars();', 100);
}

function HideStars() {
    if (clicked) return;
    SetStars(0, name1_for_hide);
}

function SetStars_ClearTimer() {
    if (stars_timeoutid > 0) clearTimeout(stars_timeoutid);
}

function SubmitStars(count1) {
    clicked = 1;
    active_textbox.value = count1;

    var form1 = document.getElementById("aspnetForm");
    form1.submit();
}
//----------------------------------------------------
// stars / rating
//----------------------------------------------------


function BindLeftHelpTopics() {
    var tableDetails = document.getElementById('ctl00_ContentPlaceHolder1_tableLeftContents');
    if (tableDetails == null) return;
    tableDetails.style.display = '';
    //table_details.style.position = 'absolute';
    //table_details.style.top = '280px'; //px needed for FF, IE is OK without it
    //table_details.style.left = '20px';

    var tdLeftX = document.getElementById('ctl00_tdLeftX');
    tdLeftX.insertBefore(tableDetails, null);
}
