﻿function DrawBanner(DivName,WidthX,HeightY,BannerName)
{
    var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
    // Handle all the FSCommand messages in a Flash movie.
        document.write('<script language=\"javascript\"\>\n');
	    document.write('function '+BannerName+'_DoFSCommand(command, args) {');
	    document.write('var '+BannerName+'Obj = isInternetExplorer ? document.all.'+BannerName+' : document.'+BannerName+';');
        document.write('if (command == "openWindow") {OpenChatR(0);};}');
        document.write('</script\>\n');
    // Hook for Internet Explorer.
        if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) 
        {
            document.write('<script language=\"VBScript\"\>\n');
            document.write('On Error Resume Next\n');
            document.write('Sub '+BannerName+'_FSCommand(ByVal command, ByVal args)\n');
            document.write('	Call '+BannerName+'_DoFSCommand(command, args)\n');
            document.write('End Sub\n');
            document.write('</script\>\n');
        }   
        document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="'+BannerName+'" width="'+WidthX+'" height="'+HeightY+'" align="middle">');
        document.write('<param name="allowScriptAccess" value="always" />');      
        document.write('<param name="movie" value="'+IIS_SERVER_LINK+'Flash/'+BannerName+'.swf" />');
        document.write('<param name="menu" value="false" />');
        document.write('<param name="quality" value="high" />');
        document.write('<param name="bgcolor" value="#ffffff" />');
        document.write('<embed src="'+IIS_SERVER_LINK+'Flash/'+BannerName+'.swf" menu="false" quality="high" bgcolor="#ffffff" width="'+WidthX+'" height="'+HeightY+'" swLiveConnect="true" id="'+BannerName+'" name="'+BannerName+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
        document.write('</object>');
        //document.write('<script language=\"javascript\"\>\n');
        //document.write('var so = new SWFObject("'+IIS_SERVER_LINK+'Flash/'+BannerName+'.swf", "", "'+WidthX+'", "'+HeightY+'", "8", "#000000");');                 
        //document.write('so.addParam("allowScriptAccess", "always");');
        //document.write('so.addParam("menu", "false");');
        //document.write('so.addParam("quality", "high");');
        //document.write('so.addParam("bgcolor", "#ffffff");');
        //document.write('so.write("'+DivName+'");');
        //document.write('</script\>\n');         
}

        /////////////////////////  Real Media ///////////////////////////////////////
    function BrowserCheck() 
    {
	    var b = navigator.appName
	    if (b=="Netscape") this.b = "ns"
	    else if (b.toLowerCase().indexOf("explorer")!=-1) this.b = "ie"
  	    else this.b = b
	    this.version = navigator.appVersion
	    this.v = parseInt(this.version)
	    this.ns = (this.b=="ns" && this.v>=4)
	    this.ns4 = (this.b=="ns" && this.v==4)
	    this.ns5 = (this.b=="ns" && this.v==5)
	    this.ns6 = (this.b=="ns" && this.v==6)
	    this.ie = (this.b=="ie" && this.v>=4)
	    this.ie4 = (this.version.indexOf('MSIE 4')>0)
	    this.ie5 = (this.version.indexOf('MSIE 5')>0)
	    this.ie6 = (this.version.indexOf('MSIE 6')>0)
	    this.min = (this.ns||this.ie)
    }

    ads_browser_is = new BrowserCheck();

    var oas = "http://rm.tapuz.co.il/RealMedia/ads/";
    if (document.location.protocol == "https:")
	    oas = "https://rm.tapuz.co.il/RealMedia/ads/";
    var RN = new String (Math.random());
    var RNS = RN.substring(2,11);
    var AsyncElementsIds = new String("");
    var MaxAsyncElementsIds = 1;
    
    function RM_Ads( sitepage, position, width, height, DivId, refrtime ) {
        //alert("RM_Ads(" + sitepage+","+ position+","+ width+","+ height+", "+DivId+","+ refrtime+")")
        //alert(document.getElementById(DivId))
	    if (document.getElementById(DivId))
	    {
	 	    var oaspage;
	 	    var sitepageStr = new String(sitepage);
	 	    var positionStr = new String(position);
	 	    //oaspage = sitepage + '/1' + RNS + '@' + position;
	 	    oaspage = sitepage + '/1' + RNS + '@' + position + "?" + sitepage.replace("/","&");
		    oaspage  = oaspage.replace("%20","");

	     var rr = '\<IFRAME WIDTH=' + width + ' HEIGHT=' + height + ' NORESIZE ID=mainBanner SCROLLING=No FRAMEBORDER=0 MARGINHEIGHT=0 MARGINWIDTH=0 SRC="' + oas + 'adstream_sx.ads/' + oaspage + '"\>'; 
	     if (ads_browser_is.ns ) 
	     {
	       rr += '\<SCR'+'IPT LANGUAGE="JavaScript1.1" SRC="' + oas + 'adstream_jx.ads/' + '@Top2,Left2!' + oaspage + '">';
	       rr += '\<\!-- --\>';
	       rr += '\<\/SCRIPT\>';
	     }
	     rr += '\<\/IFRAME\>';    	    
	     document.getElementById(DivId).innerHTML = "";	
	     document.getElementById(DivId).innerHTML = rr;
	    } 
          if (refrtime > 0)
	       setTimeout("RM_Ads('" + sitepage + "','" + position + "'," + width + "," + height + "," + "'" + DivId + "'," + refrtime + ")",refrtime);

    }
/////////////////////////  Real Media ///////////////////////////////////////
