var DomainName="http://www.hedir.com";
document.write('<script type="text/javascript" src="'+DomainName+'/sys/common/tools/js/movable-win.js"></script>');
function showSiteRecommenddiv(SiteRecommendStatus)
{                                                            
        var IframeObj = document.getElementById('SiteRecommendInfoIFrame');
           IframeObj.src =DomainName+'/submit-sites/vote.php?VoteStatus='+SiteRecommendStatus+'&TopicID='+RecommendSiteID;
        setTimeout("winList['SiteRecommendWindow'].open()", 500);
}

function FnShowInitialTableForSiteRecommendForm(SiteRecommendLink)
{
        var InitialTable = ''; 
        var IframeCode = '<IFRAME id="SiteRecommendInfoIFrame" src="" scrolling="auto" frameborder="0" width="100%" height="100%"></IFRAME>';
        var WindowHTMLCode = '<div id="SiteRecommendWindow" class="window" style="left: 219px; z-index: 6; width: 535px; visibility:hidden;" align="left">';
        WindowHTMLCode += '<div style="" class="titleBar">';
        WindowHTMLCode += '<span style="" class="titleBarText">Site Recommend.</span>';
        WindowHTMLCode += '<span style=""><img class="titleBarButtons" alt="" src="'+DomainName+'/styles/basic/img/nav-button.gif" usemap="#MiniForumMap">';
        WindowHTMLCode += '<map id="MiniForumMap" name="MiniForumMap">';
        WindowHTMLCode += '<area shape="rect" coords="0,0,15,13" href="" alt="" title="Minimize" onclick="this.parentWindow.minimize();return false;">';
        WindowHTMLCode += '<area shape="rect" coords="16,0,31,13" href="" alt="" title="Restore" onclick="this.parentWindow.restore();return false;">';
        WindowHTMLCode += '<area shape="rect" coords="34,0,49,13" href="" alt="" title="Close" onclick="this.parentWindow.close();return false;">';
        WindowHTMLCode += '</map></span></div>';
        WindowHTMLCode += '<div id="ShowTopicInfo" class="clientArea" style="top:30px; height:390px" >'+IframeCode+'</div>';
        WindowHTMLCode += '</div>';
        
      InitialTable =  this.FnCreateSiteRecommendList(SiteRecommendLink);
      document.getElementById('SiteRecommendBoard').innerHTML = InitialTable+WindowHTMLCode;            

        
}
function FnCreateSiteRecommendList(SiteRecommendLink)
{
   
     var InitialTable = ''; 
     if(SiteRecommendLink =='http://www.hedir.com/')
        {
                
                InitialTable += '<table border="0" cellspacing="0" cellpadding="5"  bordercolor="black" width="170px" height="10%">';
                InitialTable += '<tr><td valign="top" class="hedirmessagetext">';
                InitialTable += '<a href="javascript:showSiteRecommenddiv(\'yes\');" class="hedir">Yes</a><a href="javascript:showSiteRecommenddiv(\'yes\');" class="hedir"><img src="'+DomainName+'/styles/basic/img/community-yes.gif" border="0"></a> &nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:showSiteRecommenddiv(\'no\');" class="hedir">No</a><a href="javascript:showSiteRecommenddiv(\'no\');" class="hedir"><img src="'+DomainName+'/styles/basic/img/community-no.gif" border="0"></a>';
                InitialTable += '</td></tr></table>';

                
       }
        else
        {
               InitialTable += 'Oops, Either the code has changed or it is manipulated at your end. Please get the code again from <a href="'+DomainName+'/groupthink/about'+RecommendSiteID+'.html">Hedir Community Review Process</a>'; 
        }
       return  InitialTable;

}

function FnInitialiseCSSAndShowInitialTableForSiteRecommendForm()
{
       var SiteRecommendLinkInArray = FnExplodeSiteRecommendLinkURL(document.getElementById('SiteRecommendLink'),"/");   
       var SiteRecommendLink=SiteRecommendLinkInArray[0]+"//"+SiteRecommendLinkInArray[2]+"/"; 
                                        
       FnShowInitialTableForSiteRecommendForm(SiteRecommendLink);
}
FnInitialiseCSSAndShowInitialTableForSiteRecommendForm();
/* This function will explode the string in to array. */

function FnExplodeSiteRecommendLinkURL(inputstring, separators, includeEmpties) {
                inputstring = new String(inputstring);
                separators = new String(separators);

                if(separators == "undefined") {
                separators = " :;";
                }

                fixedExplode = new Array(1);
                currentElement = "";
                count = 0;

                for(x=0; x < inputstring.length; x++) {
                char = inputstring.charAt(x);
                if(separators.indexOf(char) != -1) {
                if ( ( (includeEmpties <= 0) || (includeEmpties == false)) && (currentElement == "")) { }
                else {
                fixedExplode[count] = currentElement;
                count++;
                currentElement = ""; } }
                else { currentElement += char; }
                }

                if (( ! (includeEmpties <= 0) && (includeEmpties != false)) || (currentElement != "")) {
                fixedExplode[count] = currentElement; }
                return fixedExplode;
}
