/***********************************************
* Highlight Table Cells Script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
//Specify highlight behavior. "TD" to highlight table cells, "TR" to highlight the entire row:
var highlightbehavior="TD"
var newFontColor = "black"
var originalFontColor = "black"

var ns6=document.getElementById&&!document.all
var ie=document.all

function changeto(e,highlightcolor){
 source=ie? event.srcElement : e.target
 if (source.tagName=="TABLE")
  return
 while(source.tagName!=highlightbehavior && source.tagName!="HTML")
  source=ns6? source.parentNode : source.parentElement
 if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore") {
   if (source.id!="ignore" ) source.style.backgroundColor=highlightcolor
   var tTab = document.getElementById('menubartable')
   for (var i_tem = 0; i_tem < tTab.rows.length; i_tem++)
    for (var j_tem = 0; j_tem < tTab.rows[i_tem].cells.length; j_tem++)
     if(j_tem==_getCellIndex(source))
       tTab.rows[i_tem].cells[j_tem].style.backgroundColor=highlightcolor
      
   //source = source.getElementsByTagName("A")[0];
   //alert(typeof(source))
   //if (typeof(source) !== "undefined") {
	 //source.style.color=newFontColor
   //source.style.backgroundColor=highlightcolor
   //}
 }
}


var src;
var oldsrc;


function changetosimple(e,highlightcolor){
 if (typeof window.src === 'undefined')  { 
   src=document.getElementById('tr1');
 } else {
   if (typeof src !== 'undefined') src.style.backgroundColor=""; 
 }
 source=ie? event.srcElement : e.target
 if (source.tagName=="TABLE")
  return
 while(source.tagName!=highlightbehavior && source.tagName!="HTML")
  source=ns6? source.parentNode : source.parentElement
 if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore") {
    src = source
    source.style.backgroundColor=highlightcolor;
 }
}




        function _getCellIndex(cell) {
            var rtrn = cell.cellIndex || 0;
            if (rtrn == 0) {
                do{
                    if (cell.nodeType == 1) rtrn++;
                    cell = cell.previousSibling;
                } while (cell);
                --rtrn;
            }
            return rtrn;
        }//eof getCellIndex
				

function contains_ns6(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}


function changeback(e,originalcolor,origfontcolor){
 if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE")
  return
 else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
  return
 if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source) {
  source.style.backgroundColor=originalcolor
  if (origfontcolor == '' || origfontcolor == null){
	  source.style.color=originalFontColor;
	} else {  
	  source.style.color=origfontcolor;
	}
	if (source.tagName == "A") {
	   source = source.parentNode;
	} else if (source.tagName == "TD"){ 
    var tTab = document.getElementById('menubartable')
    for (var i_tem = 0; i_tem < tTab.rows.length; i_tem++)
     for (var j_tem = 0; j_tem < tTab.rows[i_tem].cells.length; j_tem++)
      if(j_tem==_getCellIndex(source))
       tTab.rows[i_tem].cells[j_tem].style.backgroundColor=originalcolor;
   	source = source.getElementsByTagName("A")[0];
  }

  //source.style.color=originalFontColor;
  //source.style.backgroundColor=originalcolor;
 }
}


function open_win(url_add){
   window.open(url_add,'welcome','width=760,height=500,menubar=no,status=yes,location=no,toolbar=no,scrollbars=yes');  
}


function toggleDivOnOff(divid){
if (document.getElementById(divid).style.display == 'none')
   document.getElementById(divid).style.display = 'block';
else
   document.getElementById(divid).style.display = 'none';
}


function alternate(id){
 if(document.getElementsByTagName){  
   var table = document.getElementById(id);  
   var rows = table.getElementsByTagName("tr");  
   for(i = 0; i < rows.length; i++){          
 //manipulate rows
     if(i % 2 == 0){
       rows[i].className = "even";
     }else{
       rows[i].className = "odd";
     }      
   }
 }
}

/* ------------------------

Menu functions

--------------------------- */
function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1)
        {
					//alert('x=' + curleft);
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }


var delayhide;

function showMenu(objMenu) {
	
if (typeof src !== 'undefined')
{ 	
	src.style.backgroundColor="#9a9a9a"
}

if(delayhide)
	{
		window.clearTimeout(delayhide);
		delayhide = null;
	}

if (objMenu == 'menuBoxAlertHQ') {
   var objDiv = document.getElementById("mbA");
   document.getElementById('menuBoxDownload').style.visibility='hidden';
   document.getElementById('menuBoxTools').style.visibility='hidden';
   document.getElementById('menuBoxPremium').style.visibility='hidden';
} else if (objMenu == 'menuBoxTools') {
   var objDiv = document.getElementById("mbT");
   document.getElementById('menuBoxAlertHQ').style.visibility='hidden';
   document.getElementById('menuBoxDownload').style.visibility='hidden';
   document.getElementById('menuBoxPremium').style.visibility='hidden';
} else if (objMenu == 'menuBoxDownload') {
   var objDiv = document.getElementById("mbD");
   document.getElementById('menuBoxAlertHQ').style.visibility='hidden';
   document.getElementById('menuBoxTools').style.visibility='hidden';
   document.getElementById('menuBoxPremium').style.visibility='hidden';
} else {
   var objDiv = document.getElementById("mbP");
   document.getElementById('menuBoxAlertHQ').style.visibility='hidden';
   document.getElementById('menuBoxDownload').style.visibility='hidden';
   document.getElementById('menuBoxTools').style.visibility='hidden';
}
var objMenuDiv = document.getElementById(objMenu);
var curleft = findPosX(objDiv);
var curtop = objDiv.clientHeight-4;
if (typeof isBlog !== 'undefined') {
   if (isBlog) curtop = curtop-5;
}
if (document.all&&document.getElementById) {
	curtop = curtop-1;
	 objMenuDiv.style.top = (objDiv.offsetTop + objDiv.scrollHeight + curtop)
	 objMenuDiv.style.left =  curleft //- findPosX(document.getElementById("main-wrapper")) - 100
} else { //not IE
	 objMenuDiv.style.top = (objDiv.offsetTop + objDiv.scrollHeight + curtop - 1) + 'px'
	 //objMenuDiv.style.left =  (curleft - findPosX(document.getElementById("main-wrapper")) - 100) + 'px'
	 objMenuDiv.style.left =  curleft + 'px'
}
objMenuDiv.style.visibility = 'visible';
objMenuDiv.style.zIndex = 100;

}

function hideMenu(objMenu) {

oldsrc = src;
		
var tTab = document.getElementById('menubartable')
if (objMenu == 'menuBoxAlertHQ') {
	   delayhide=setTimeout("document.getElementById('menuBoxAlertHQ').style.visibility='hidden';oldsrc.style.backgroundColor='';",220)
	   //tTab.rows[0].cells[2].style.backgroundColor="";
} else if (objMenu == 'menuBoxAlertHQ') {
   delayhide=setTimeout("document.getElementById('menuBoxAlertHQ').style.visibility='hidden';oldsrc.style.backgroundColor='';",220)
} else if (objMenu == 'menuBoxTools') {
   delayhide=setTimeout("document.getElementById('menuBoxTools').style.visibility='hidden';oldsrc.style.backgroundColor='';",220)
} else  if (objMenu == 'menuBoxDownload') {
   delayhide=setTimeout("document.getElementById('menuBoxDownload').style.visibility='hidden';oldsrc.style.backgroundColor='';",220)
} else {
   delayhide=setTimeout("document.getElementById('menuBoxPremium').style.visibility='hidden';oldsrc.style.backgroundColor='';",220)
}
//src.style.backgroundColor='';
}

/*
Script Name: Javascript Cookie Script
Author: Public Domain, with some modifications
Script Source URI: http://techpatterns.com/downloads/javascript_cookies.php
Version 1.0.0
Last Update: 30 May 2004

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
*/

// this function gets the cookie, if it exists
function Get_Cookie( 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 ) );
}

/*
only the first 2 parameters are required, the cookie name, the cookie
value. Cookie time is in milliseconds, so the below expires will make the 
number you pass in the Set_Cookie function call the number of days the cookie
lasts, if you want it to be hours or minutes, just get rid of 24 and 60.

Generally you don't need to worry about domain, path or secure for most applications
so unless you need that, leave those parameters blank in the function call.
*/
function Set_Cookie( name, value, expires, path, domain, secure ) {
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	// if the expires variable is set, make the correct expires time, the
	// current script below will set it for x number of days, to make it
	// for hours, delete * 24, for minutes, delete * 60 * 24
	if ( expires )
	{
		expires = expires * 1000 * 60 * 60 * 24;
	}
	//alert( 'today ' + today.toGMTString() );// this is for testing purpose only
	var expires_date = new Date( today.getTime() + (expires) );
	//alert('expires ' + expires_date.toGMTString());// this is for testing purposes only

	document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + //expires.toGMTString()
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
			( ( path ) ? ";path=" + path : "") +
			( ( domain ) ? ";domain=" + domain : "" ) +
			";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
			

/* ------Project Seven script - make DIV same height ------------------- */

function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
 var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
 if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
 dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com
 var c,e,el;if(document.getElementById){document.p7eqc=new Array();
 document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
 c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
 if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
 document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
 setInterval("P7_eqT2()",10);}
}
function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
 var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
 g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
 setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}

/* ------------------------------------
   functions supporting popping up DIVs
   ------------------------------------ */

// Updates the variable storing the vertical scrollbar co-ordinate
  function updateVerticalScrollbar(){
    if (document.documentElement && document.documentElement.scrollTop){
      scrollbarY=document.documentElement.scrollTop;
    }else if (document.body){
      scrollbarY=document.body.scrollTop;
    }
  return scrollbarY;
}

		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}
		function setContent(myContent) {
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
							if (windowHeight > 0) {
					var contentElement = document.getElementById(myContent);
					contentElement.style.display='block';
					var contentHeight = contentElement.offsetHeight;
					if (windowHeight - contentHeight > 0) {
						contentElement.style.position = 'absolute';
						scrollbarY = updateVerticalScrollbar()
						contentElement.style.top = scrollbarY + ((windowHeight / 2) - (contentHeight / 2)) + 'px';
					}
					else {
						scrollbarY = updateVerticalScrollbar()
						contentElement.style.position = 'absolute';
						contentElement.style.top = scrollbarY + (windowHeight / 10) + 'px';
					}
					contentElement.style.display='block';
				}			}
		}

function DirectToDownload() {
 var postURL = "http://trade-radar.com/download/download-done.html";
 document.location.href= postURL;
 return true;
}

/***********************************************
* Cool DHTML tooltip script II- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).


function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
pointerobj.style.left=curX-offsetfromcursorX-20+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}



/* -------------------------------	 
Support ads in Blogger
---------------------------------- */
function rotatePostAd() {

if (trBlogPostCount == 1) {
  document.writeln('<br\/><script>google_ad_client = "pub-8376442676111082";google_ad_slot = "0805181815";google_ad_width = 468;google_ad_height = 60;<\/' +
  'script><script type="text/javascript" src="http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js"><\/' + 'script><br\/><br\/>');
  trBlogPostCount++;
} else if (trBlogPostCount == 2) {
  document.writeln('<br\/><br\/><a href="http:\/\/www.ino.com\/info\/98\/CD3320\/&dp=0&l=0&campaignid=12"><img src="http:\/\/ino.directtrack.com\/42\/3320\/98\/" alt="" border="0"><\/a><br\/><br\/>');
  trBlogPostCount++;
} else if (trBlogPostCount == 3) {
  document.writeln('<br\/><br\/><a href="http:\/\/www.ino.com\/info\/205\/CD3320\/&dp=0&l=0&campaignid=9"><img src="http:\/\/ino.directtrack.com\/42\/3320\/205\/" alt="" border="0"><\/a><br\/><br\/>');
  trBlogPostCount++;
}

}


	
