﻿function ToggleBlogCategory(oCategory, cLinkId)
{
    var oLinks = document.getElementById(cLinkId);
    if(oLinks)
    {
        if(oLinks.className=='links hide')
        {
            oLinks.className = 'links';
        }
        else
        {
            oLinks.className = 'links hide';
        }
    }
    
    if(oCategory)
    {
        if(oCategory.className=='category closed')
        {
            oCategory.className = 'category open';
        }
        else
        {
            oCategory.className = 'category closed';
        }
    }
    
    return false;
}

function printDetails()
{
  var prt = window.open();
  prt.document.open();
  prt.document.writeln("<HTML>\n<HEAD>\n<TITLE>AiP</TITLE>\n");
  prt.document.writeln("<link rel=\"stylesheet\" type=\"text/css\" href=\"files/reset.css\" />");
  prt.document.writeln("<link rel=\"stylesheet\" type=\"text/css\" href=\"files/mainframe_print.css\" />");
  prt.document.writeln("<link rel=\"stylesheet\" type=\"text/css\" href=\"files/elements.css\" />");
  prt.document.writeln("<link rel=\"stylesheet\" type=\"text/css\" href=\"files/forms.css\" />");
  prt.document.writeln("</HEAD>\n");
  
  prt.document.writeln('\n<body>');
  prt.document.writeln('<div id=\"container\">\n');
  prt.document.writeln('<div id=\"content\">\n');
  prt.document.writeln('<div align=\"center\"><img src=\"files/images/newspapers0.png\" /></div>\n');
  prt.document.writeln('<div id=\"left\">\n');
  
  prt.document.writeln(document.getElementById("left").innerHTML);
  
  prt.document.writeln('</div>\n');
  prt.document.writeln('</div>\n');
  prt.document.writeln('</div>\n');
  
 
  prt.document.writeln("<script>window.print();</script></BODY>\n</HTML>");
  prt.document.close();
    return false;
}


function tipFriend()
{
	var cUrl = 'popup.aspx?page=21&tipsaurl=' + getTipsaUrl();
	window.open(cUrl,'','width=260,height=379, scrollbars=no');
	return false;
}

function getTipsaUrl()
{
    var myUrl = document.location.href;

    myUrl = myUrl.replace(new RegExp(/&/g), "XXX"); 
    myUrl = myUrl.replace(new RegExp(/=/g), "YXY"); 
    myUrl = myUrl.replace(new RegExp(/#/g), ""); 

    return myUrl;
}

function doSelect(n, cCatId, cSearchId)
{
    var optionel, obj, i, j, selectobjfrom, selectobjto, inhtml;


    selectobjfrom = n==1 ? document.getElementById(cCatId) : document.getElementById(cSearchId);
    selectobjto = n==1 ? document.getElementById(cSearchId) : document.getElementById(cCatId);

    
    i= selectobjfrom.selectedIndex;
    if (i!=-1)
    {
        obj=selectobjfrom.options[i];

        optionel=document.createElement("OPTION");
        optionel.text=obj.text;
        optionel.value=obj.value;
        selectobjto.options.add(optionel);
        
        selectobjfrom.remove(i);
    }
    else
    {
	    alert ('Please choose item.');
    }
}

function SelectSearch(cSearchId)
{
    var oSearch = document.getElementById(cSearchId);
    if(oSearch)
    {
        for(var i=0; i<oSearch.options.length; i++)
        {
            oSearch.options[i].selected = true;
        }
    }
    
    return false;
}