//Cookie functions

function getArgs() {
	var args = new Object();
	// Get Query String
	var query = location.search.substring(1); 
	// Split query at the comma
	var pairs = query.split("&"); 
	
	// Begin loop through the querystring
	for(var i = 0; i < pairs.length; i++) {

		// Look for "name=value"
		var pos = pairs[i].indexOf('='); 
		// if not found, skip to next
		if (pos == -1) continue; 
		// Extract the name
		var argname = pairs[i].substring(0,pos); 
		
		// Extract the value
		var value = pairs[i].substring(pos+1); 
		// Store as a property
		args[argname] = unescape(value);
	}
	return args; // Return the Object
}


// This function retreives the value of the tracking cookie
function getCookies () {
	// Get the document.cookie
	var dc = document.cookie;
        var args = new Object();
        // Split cookie at the semicolon
        var pairs = dc.split(";");
        // Begin loop through the cookie
        for(var i = 0; i < pairs.length; i++) {

                // Look for "name=value"
                var pos = pairs[i].indexOf('=');
                // if not found, skip to next
                if (pos == -1) continue;
                // Extract the name
                var argname = pairs[i].substring(0,pos);

                // Extract the value
                var value = pairs[i].substring(pos+1);
                // Store as a property
                args[argname.toLowerCase()] = unescape(value.toLowerCase());
        }
        return args; // Return the Object
}


function getCookieVal (offset) 
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
   endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}


function GetCookie (name) 
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) 
{
   var j = i + alen;
   if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
   i = document.cookie.indexOf(" ", i) + 1;
   if (i == 0) break; 
   }
return null;
}


function SetCookie (name, value) 
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : "/";
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  ((path == null) ? "" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
}


function SetCookieEverlasting(name, value) 
{
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (2 * 365 * 24 * 3600 * 1000));
SetCookie(name,value,ExpireDate);
}

function DeleteCookie (name) 
{
var exp = new Date();
exp.setTime (exp.getTime() - 1000000000);  // This cookie is history (changed -1 to make it previous time)
SetCookie(name,"",exp);
//var cval = GetCookie ( name );
//document.cookie =name + "=" + cval + "; expires=" + exp.toGMTString();
}


function checkandset( name, value )
{
  if ( !(GetCookie(name) && (GetCookie(name) != "") && (GetCookie(name) != "undefined")) )
    if (value && value != "")  SetCookieEverlasting( name, value );
}


function override( name, value )
{
  if (value && value != "")  
    SetCookieEverlasting( name, value );
}


function LicenseDesc(license_type){
 var win = open("/license_popup_text.html#"+license_type,"","width=600,height=200,scrollbars=no");
}


function ScreenShot(image_url){
 var win = open(image_url,"","width=600,height=400,scrollbars=yes,resizable");
}


function AddMyFavorite( url, title )
{
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}


function bookmark(){
  var url = window.document.location;
  var title = window.document.title;
  AddMyFavorite( url, title );
}


function update_cd_count()
{
  var cd = GetCookie('cd');
  var pairs = cd.split(","); 
  var i = pairs.length;
  var text;
  if (i == 0)
    text = "What's this?";
  else if (i == 1)
    text = "1 title";
  else 
    text = i + " titles";

  if (typeof(document.getElementById) != 'undefined') 
  {
    theCells = document.getElementById('cdcount');
    theCells.innerHTML = text;
  }
}


function alterCD( id, isAdd )
{
  var cd = GetCookie('cd');

  if (isAdd)
  {
    //add to CD
    cd += ',' + id;
//    alert( "Added " + id );
  } else {
    //remove from CD
    cd = cd.replace( id, "" );
//    alert( "Removed " + id );
  }

  SetCookieEverlasting( 'cd', cd );
  return true;
}


function setCheckboxes(the_form, do_check)
{
    var elts = the_form.elements['ids[]'];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        } // end for
    } else {
        elts.checked        = do_check;
    } // end if... else
//  update_cd_count();
}


function add_to_cd( id )
{
  SetCookieEverlasting( 'cd', GetCookie('cd') + ',' + id );
  alert( "Product added to CD - Only $9.95 Worldwide (including shipping!)\r\n\r\nTo check out and pay for your CD, click \"My CD\" at top right" );
//  update_cd_count();
}


function a2cd( id )
{
  add_to_cd( id );
}


//make the form checkboxes match the cd cookie
function updateCheckboxes(the_form)
{
  //disable for now
  return;
  
  var cd = GetCookie('cd');

  var elts = the_form.elements['ids[]'];
  var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

  if (elts_cnt) {
      for (var i = 0; i < elts_cnt; i++) {
        if ( (cd.indexOf( elts[i].value) != -1 ) && (typeof(elts[i]) != 'undefined'))
          elts[i].checked = true;
      } // end for
  } else {
    //single checkbox
    if (cd.indexOf( elts.value ) != -1 )
      elts.checked = true;
  } // end if... else
}


function add_lots_to_cd(the_form)
{
  var cd = GetCookie('cd');
  
  var elts = the_form.elements['ids[]'];
  var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

  var added = 0;
  if (elts_cnt) {
      for (var i = 0; i < elts_cnt; i++)
        if (elts[i].checked) {
//          alert( "test:adding " + i + " value " + elts[i].value );
          cd += ',' + elts[i].value;
          added++;
        }
  } else {
    //single checkbox
    cd += ',' + elts.value;
    added++;
  } // end if... else

  if (added > 0)
  {
    SetCookieEverlasting( 'cd', cd );
    alert( added + " product(s) added to CD - Only $9.95 Worldwide (including shipping!)\r\n\r\nTo check out and pay for your CD, click \"My CD\" at top right" );
  }
  else
    alert( "To add titles to your CD, first click the Checkbox next to one or more titles" );
//  update_cd_count();
}


function add_watches(the_form)
{
  var elts = the_form.elements['ids[]'];
  var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

  var added = 0;
  if (elts_cnt) 
  {
    for (var i = 0; i < elts_cnt; i++)
      if (elts[i].checked) 
      {
        added++;
        break;
      }
  }
  else
  {
    //single checkbox
    if (elts.checked)
      added++;
  }

  if (added > 0)
    the_form.submit();
  else
    alert( "To add titles to your Watch List, first click the Checkbox next to one or more titles" );
}


function jumpTo( name )
{
  if (name != 'Category: All')
  {
    name = name.toLowerCase();
    name = name.replace( / \& |:|\/| |\#|\+|\-/g, '_' );
    name = name.replace( /_{1,}/g, '_' );
    document.location.href = "http://www.downloadpipe.com/" + name;
  }
  else
    document.location.href = "http://www.downloadpipe.com/categories.html";
//    alert( 'Please choose a category to jump to' );
}


function jumpToOS( name )
{
  //note - based on display string
  if (name == 'All')
    alert( 'Please choose an Operating System to jump to' );
  else if (name == 'Windows')
    document.location.href = "/Windows-platform.html";
  else if (name == 'Vista')
    document.location.href = "/Vista-platform.html";
  else if (name == 'Linux')
    document.location.href = "/Linux-platform.html";
  else if (name == 'Mac')
    document.location.href = "/Mac-platform.html";
  else if (name == 'PDA')
    document.location.href = "/PDA-platform.html";
  else if (name == 'Mobile')
    document.location.href = "/Mobile-platform.html";
  else if (name == 'Java')
    document.location.href = "/Java-platform.html";
  else if (name == 'DOS')
    document.location.href = "/DOS-platform.html";
  else if (name == 'OS/2')
    document.location.href = "/OS2-platform.html";
  else if (name == 'BeOS')
    document.location.href = "/BeOS-platform.html";
  else if (name == 'Netware')
    document.location.href = "/Netware-platform.html";
  else if (name == 'AS/400')
    document.location.href = "/AS400-platform.html";
  else if (name == 'NextStep')
    document.location.href = "/NextStep-platform.html";
  else 
    alert('Invalid Platform ' + name );
}




var link_stat = false; 

function popunder( url, target ) {
  pu = window.open( url, target );
  pu.blur();
  window.focus();
}


window.onunload=function()
{ 
  if(!link_stat)
  {
    //test country
    if (navigator.language) 
      { Lang=navigator.language } 
    else 
      { Lang=navigator.userLanguage }


 
  }
} 



function testLinks()
{ 
  var ln=document.links.length; 
  for(var i=0;i<ln;i++)
  { 
    document.links[i].onclick=function()
    { 
      var test_url=/downloadpipe\.com/i; 
      var lnk_url=this.href; 
      link_stat = test_url.test(lnk_url);
//      alert(link_stat); 
      return true; 
    }; 
  } 
} 



var marked_row = new Array;

/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   integer  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 1.1 Sets the mouse pointer to pointer on mouseover and back to normal otherwise.
    if (theAction == "over" || theAction == "click") {
        theRow.style.cursor='pointer';
    } else {
        theRow.style.cursor='default';
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0)
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;

            //invert the row's checkbox
            theRow.getElementsByTagName('input')[0].checked = true;

            marked_row[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            theRow.getElementsByTagName('input')[0].checked = true;
            marked_row[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
            theRow.getElementsByTagName('input')[0].checked = marked_row[theRowNum];
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


//see also padgen
function rss_selected( obj, url )
{
  var i = obj.options[obj.selectedIndex].value;
  var r = "";
  if (i == 1)      r = "http://www.bloglines.com/sub/" + url;
  else if (i == 2) r = "http://www.google.com/reader/preview/*/feed/" + escape(url);
  else if (i == 3) r = "http://us.rd.yahoo.com/my/atm//Most%20recent%20software/*http://add.my.yahoo.com/rss?url=" + escape(url);
  else if (i == 4) r = "http://www.newsgator.com/ngs/subscriber/subext.aspx?url=" + escape(url);
  else if (i == 5) r = "http://www.kinja.com/checksiteform.knj?add=" + escape(url);
  else if (i == 6) r = "http://technorati.com/faves?add=" + escape(url);
  else if (i == 7) r = "http://www.bitty.com/manual/?contenttype=rssfeed&contentvalue=" + escape(url);
  else if (i == 8) r = "http://my.msn.com/addtomymsn.armx?id=rss&amp;ut=' + escape(url) + '&amp;ru=http://www.DownloadPipe.com/";
  else if (i == 9) r = "http://feeds.my.aol.com/add.jsp?url=" + escape(url);
  else if (i ==10) r = "http://my.feedlounge.com/external/subscribe?url=" + escape(url);
  else if (i ==11) r = "http://www.netvibes.com/subscribe.php?url=" + escape(url);
  else if (i ==12) r = "http://www.rojo.com/add-subscription?resource=" + escape(url);
  else if (i ==13) r = "http://www.feedster.com/myfeedster.php?action=addrss&amp;confirm=no&amp;rssurl=" + escape(url);

  if (r != '') document.location = r;
  return true;
}


//Management of RSS
var rss = "";

function getRSSbox( id, rss )
{
  return "<div class=\"rssbox\" style=\"display:block;\">" +
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" +
"<tr><td width=\"90%\">&nbsp;<span class=\"blueb\">RSS Feed</span></td><td><a href=\"javascript:hideRSSbox( '" + id + "' );\"><img src=\"/images/btn_close.gif\" " +
"	alt=\"Close\" width=\"18\" height=\"17\" border=\"0\" align=\"absmiddle\" hspace=\"5\" vspace=\"5\"></a></td></tr>" +
"<tr><td colspan=\"2\">&nbsp;" +

"<select class=\"select\" style=\"width:260px\" onchange=\"javascript:rss_selected(this,rss);\"> " +
"<option value=\"0\">add to an RSS feed...</option> " +
"<option value=\"1\">to Bloglines</option> " +
"<option value=\"2\">to Google</option> " +
"<option value=\"3\">to My Yahoo!</option> " +
"<option value=\"4\">to newsgator</option> " +
"<option value=\"5\">to kinja</option> " +
"<option value=\"6\">to Technorati</option> " +
"<option value=\"7\">to BittyBrowser</option> " +
"<option value=\"8\">to My MSN</option> " +
"<option value=\"9\">to My AOL</option> " +
"<option value=\"10\">to feedlounge</option> " +
"<option value=\"11\">to netvibes</option> " +
"<option value=\"12\">to rojo</option> " +
"<option value=\"13\">to feedster</option> " +
"</select>" +

"</td></tr>" +
"<tr><td colspan=\"2\">&nbsp;<a href='" + rss + "' class=\"blue\">" + rss + "</a></td></tr>" +
"</table>" +
"</div>";
}

function showRSSbox(id,rss_feed)
{
	rss_feed = 'http://www.downloadpipe.com/' + rss_feed;
	rss = rss_feed;
	document.getElementById(id).innerHTML = getRSSbox( id, rss_feed );
	return true;
}

function hideRSSbox(id)
{
	document.getElementById(id).innerHTML = "";
//	return true;
}
    		
function showHideRSSbox(id,rss_feed)
{
  if (document.getElementById(id).innerHTML == "" )
    showRSSbox(id,rss_feed);
  else
    hideRSSbox(id);
}

//Management of bookmarks

function getBookmarkBox(id)
{
  return "<div class=\"bookmark\" style=\"display:block;\">" +
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" +
"<tr><td width=\"88%\">&nbsp;<span class=\"blueb\">Add a Bookmark</span></td><td><a href=\"javascript:hideBookmarkBox('"+id+"');\"><img src=\"/images/btn_close.gif\" alt=\"Close\" width=\"18\" height=\"17\" border=\"0\" align=\"absmiddle\" hspace=\"5\" vspace=\"5\"></a></td></tr>" +
"<tr><td colspan=\"2\">&nbsp;" +
"<select class=\"select\" style=\"width:180px\" onchange=\"javascript:bookmark_selected(this);\"> " +
"<option value=\"-1\">add to a Bookmark Site...</option> " +
"<option value=\"0\">add Bookmark to Browser</option> " +
"<option value=\"-1\">--Social Bookmark Sites--</option> " +
"<option value=\"1\">del.icio.us</option> " +
"<option value=\"2\">Digg</option> " +
"<option value=\"3\">Spurl</option> " +
"<option value=\"4\">Wists</option> " +
"<option value=\"5\">Simpy</option> " +
"<option value=\"6\">NewsVine</option> " +
"<option value=\"7\">Blinklist</option> " +
"<option value=\"8\">Furl</option> " +
"<option value=\"9\">Reddit</option> " +
"<option value=\"10\">Fark</option> " +
"<option value=\"11\">Blogmarks</option> " +
"<option value=\"12\">Yahoo</option> " +
"<option value=\"13\">Ma.gnolia</option> " +
"<option value=\"14\">Google</option> " +
"<option value=\"15\">Stumbleupon</option> " +
"<option value=\"16\">Netvouz</option> " +
"<option value=\"17\">Technorati</option> " +
"<option value=\"18\">Facebook</option> " +
"</select> " +
"</td></tr>" +
"</table>" +
"</div>";
}

function showBookmarkBox(id)
{
	document.getElementById(id).innerHTML = getBookmarkBox(id);
}

function hideBookmarkBox(id)
{
	document.getElementById(id).innerHTML = "";
}
  		


function bookmark_selected( obj )
{
  var i = obj.options[obj.selectedIndex].value;
  if (i == -1) return true;
  var title = document.title + ' @ downloadpipe.com';
  var url = document.location;
  var r = "";
  
  if (i == 0) {
    bookmark();
    return true;
  }
  else if (i ==  1) r = "http://del.icio.us/post?title=" + title + "&url=" + url;
  else if (i ==  2) r = "http://digg.com/submit?phase=2&url=" + url;
  else if (i ==  3) r = "http://www.spurl.net/spurl.php?title=" + title + "&url=" + url;
  else if (i ==  4) r = "http://wists.com/r.php?c=&title=" + title + "&r=" + url;
  else if (i ==  5) r = "http://www.simpy.com/simpy/LinkAdd.do?title=" + title + "&href=" + url;
  else if (i ==  6) r = "http://www.newsvine.com/_tools/seed&amp;save?h=" + title + "&u=" + url;
  else if (i ==  7) r = "http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Description=&amp;Title=" + title + "&Url=" + url;
  else if (i ==  8) r = "http://www.furl.net/storeIt.jsp?t=" + title + "&u=" + url;
  else if (i ==  9) r = "http://reddit.com/submit?title=" + title + "&url=" + url;
  else if (i == 10) r = "http://cgi.fark.com/cgi/fark/edit.pl?new_comment=" + title + "&new_url=" + url + "&new_link_other=";
  else if (i == 11) r = "http://blogmarks.net/my/new.php?mini=1&amp;simple=1&amp;title=" + title + "&url=" + url;
  else if (i == 12) r = "http://myweb2.search.yahoo.com/myresults/bookmarklet?t=" + title + "&u=" + url;
  else if (i == 13) r = "http://ma.gnolia.com/beta/bookmarklet/add?title=" + title + "&url=" + url;
  else if (i == 14) r = "http://www.google.com/bookmarks/mark?op=add&amp;title=" + title + "&bkmk=" + url;
  else if (i == 15) r = "http://www.stumbleupon.com/submit?title=" + title + "&url=" + url;
  else if (i == 16) r = "http://www.netvouz.com/action/submitBookmark?title=" + title + "&description=&url=" + url;
  else if (i == 17) r = "http://technorati.com/faves?sub=addfavbtn&amp;add=" + url;
  else if (i == 18) r = "http://www.facebook.com/share.php?u=" + url;

  if (r != '') document.location = r;
  return true;
}


//add or remove a title from the CD
function changeCD( checkbox )
{
  alterCD( checkbox.value, checkbox.checked );
//  update_cd_count();
  return true;
}


	   function topm(id){
	   folder="/images/";
	   
	   document.getElementById(id).style.cursor='pointer';
	   if (document.getElementById(id+'_sub').style.display=="block"){
	   document.getElementById(id+'_sub').style.display="none";} else {
	   document.getElementById(id+'_sub').style.display="block";
	   }
	   }


function show_old(id){
  if(document.getElementById(id).style.display=="none"){
    document.getElementById(id).style.display="block";
  } else {
    document.getElementById(id).style.display="none";
  }
}


//toggle
function adv_s(id){
  if(document.getElementById(id).style.display=='none'){
	document.getElementById(id).style.display='block';
	document.getElementById(id+'2').style.display='none';
  } else {
	document.getElementById(id).style.display='none';
	document.getElementById(id+'2').style.display='block';
  }
}


//force it to show
function adv_show(id){
	document.getElementById(id).style.display='block';
	document.getElementById(id+'2').style.display='none';
}


function show(id){
	   document.getElementById(id).style.cursor='pointer';
	   document.getElementById(id+'_sub').style.display="block";
}
function hide(id){
	   setTimeout ( document.getElementById(id).style.display="none", 2000 );
}


function switch_divs(div_list, tab_list, selected_index) 
{
	for(i=0;i<div_list.length;i++) 
	{
		div_elem = document.getElementById(div_list[i]);
		tab_elem = document.getElementById(tab_list[i]);

		if(div_elem && tab_elem) 
		{
			if( i == selected_index ) 
			{
				div_elem.style.display = 'block';
				tab_elem.className = 'selected';
			}
			else
			{
				div_elem.style.display = 'none';
				tab_elem.className = '';
			}
		}
	}
}


//Set a cookie with the referring URL if it is not already set
checkandset( "jsreferrer", document.referrer );
var args = getArgs();
//download source
checkandset( "landing", document.location );

localTime = new Date();
checkandset( "timezone", localTime.getTimezoneOffset() / 60 );


