﻿// JScript File
last_link = "";
function nav() {
  window.location = last_link;
}
function nav_in(x, h) {
  window.status=h;
  last_link = h;  
  
  if (x.className=='static') return;
  x.className='highlight';  
}

function nav_in2(x) {
  //parses the td element to find <a> tag
  //good for IE7 and FireFox2
  //
  //td id="ctl00_TD1" class="normal" onclick="nav()" onmouseover="nav_in2(this)" onmouseout="nav_out(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;
  
  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
    
  last_link = h;  
  
  if (x.className=='static') return;
  x.className='highlight';  
}

function nav_out(x) {
  if (x.className=='static') return;
  
  x.className='normal'; 
  window.status='';
}

function StartNewTopic(i) {
    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) {
    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
//----------------------------------------------------
  