//  function GetCookie (name)
//  function SetCookie (name, value)
//  function DeleteCookie (name)

// ------------------------------------------------------------------

  window.onload = function() 
  {
		var searchBackgroundColor = '#F0f0f0';
		var searchBorderColor   = '#000000';
		var stdTitleBarColor = '#e0e0e0'; // '#E6F1F8';
		var stdBorderColor   = '#666666'; // '#62C0E2';
		var stdBackgroundColor = '#ffffff';    // must also change  rcContent.css to reflect
		
		if(CornerCheck()) 
    {
			// Rounded("div#search","top","transparent",searchBackgroundColor,'border ' + searchBorderColor);
			// Rounded("div#search","bottom","transparent",searchBackgroundColor,'border ' + searchBorderColor);

			Rounded("div#email","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#email","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

			Rounded("div#listings","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#listings","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

			Rounded("div#jobs","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#jobs","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);
			
			Rounded("div#accounts","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#accounts","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

			Rounded("div#city","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#city","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

			Rounded("div#attractions","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#attractions","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);
      
			Rounded("div#fun","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#fun","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

 			Rounded("div#food","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#food","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

			Rounded("div#news","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#news","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

			Rounded("div#travel","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#travel","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

			Rounded("div#eMall","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#eMall","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);

			Rounded("div#misc","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#misc","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);
      
			Rounded("div#work","top","transparent",stdTitleBarColor,'border ' + stdBorderColor);
			Rounded("div#work","bottom","transparent",stdBackgroundColor,'border ' + stdBorderColor);
		}
	}

// ------------------------------------------------------------------

function GetCookie (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 SetCookie (name, value, expInMinutes, path, domain, secure)
{
  var expDays = 30;

  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;

  var expires     = new Date();
  var path        = (argc > 3) ? argv[3] : null;
  var domain      = (argc > 4) ? argv[4] : null;
  var secure      = (argc > 5) ? argv[5] : false;

  if (expInMinutes > 0)
    expires.setTime(expires.getTime() + (expInMinutes * 60 * 1000 ));  // 1000 is for milliseconds

  var cookieStr = name + "=" + escape (value) +
                  ((expInMinutes == 0) ? "" : ("; expires=" + expires.toGMTString())) +
                  ((path == null) ? "" : ("; path=" + path)) +
                  ((domain == null) ? "" : ("; domain=" + domain)) +
                  ((secure == true) ? "; secure" : "");

  // alert ("cookieStr: " + cookieStr);

  document.cookie = cookieStr;
}

// ------------------------------------------------------------------


function DeleteCookie (name)
{
  var exp = new Date();
  exp.setTime (exp.getTime() - 1);
  var cval = GetCookie (name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

// ------------------------------------------------------------------

function ExpandWithCookies ()
{
  if (GetCookie ('img_Blogs') != null)       Expand(dtl_Blogs, 'img_Blogs');
  if (GetCookie ('img_Web') != null)         Expand(dtl_Web, 'img_Web');
  if (GetCookie ('img_Movies') != null)      Expand(dtl_Movies, 'img_Movies');
  if (GetCookie ('img_Reference') != null)   Expand(dtl_Reference, 'img_Reference');
  if (GetCookie ('img_Intranet') != null)    Expand(dtl_Intranet, 'img_Intranet');
  if (GetCookie ('img_Reddot') != null)      Expand(dtl_Reddot, 'img_Reddot');
  if (GetCookie ('img_CMS') != null)         Expand(dtl_CMS, 'img_CMS');
  if (GetCookie ('img_LS') != null)          Expand(dtl_LS, 'img_LS');
  if (GetCookie ('img_DMS') != null)         Expand(dtl_DMS, 'img_DMS');
}

// ------------------------------------------------------------------

function Expand(obj, imgId)
{ 
    var expandIcon = "include/img/expand.gif";
  var collapseIcon = "include/img/collapse.gif";
  
  if (obj.style.display == "none")
  {
    obj.style.display = "inline";
    eval ('document.all.' + imgId + '.src = expandIcon');
    // alert ('setting cookie');
    SetCookie (imgId, '1', 60*24*365);
  }
  else
  {
    obj.style.display = "none";
    eval ('document.all.' + imgId + '.src = collapseIcon;');
    // alert ('erasing cookie');
    DeleteCookie (imgId);
  }
  return true;
}

// ------------------------------------------------------------------

  function subForm (rootUrl, search)
  {
    var url = rootUrl;

    if (document.search.query.value != '')
    {
        var sQuery = document.search.query.value;
    	
    	sQuery = sQuery.toLowerCase ();
    	
        if (sQuery.indexOf (' ') == -1 && 
           (sQuery.indexOf ('www.') >= 0 ||
     	      sQuery.indexOf ('.net') >= 0 ||
     	      sQuery.indexOf ('.com') >= 0 ||
     	      sQuery.indexOf ('.ca')  >= 0 ||
     	      sQuery.indexOf ('.biz') >= 0 ||
     	      sQuery.indexOf ('.org') >= 0 )
          )
    	{
    	  url = '';
    	  
    	  if (sQuery.indexOf ('http') == -1)
    	    url = 'http://';
    	  
    	  url += sQuery;
    	}
    	else
    	{
          url += search + sQuery;
        }
    }
    // alert (url);
    window.open (url, '');
    
    return false;
  }
  
