﻿function RenderBreadCrumb(sElement)
{
    //create our XmlHttpRequest object
    var oXmlHttp = createXmlHttpRequest();
    
    var sUrl = "/handlers/BreadCrumbHandler.ashx?PageUrl=" + window.location;
    
    oXmlHttp.open("GET", sUrl, false);
    oXmlHttp.send(null);
    
    var sResponse = "";
	sResponse = oXmlHttp.responseText;
	
	if(sResponse != "" || sResponse != null)
	{
	    if(document.getElementById(sElement)){
            document.getElementById(sElement).innerHTML = sResponse;
        }
    }
}
 
 window.addEvent('domready', function() {
    new rokmoomenu($E('ul.nav'), {
	    bgiframe: false,
	    delay: 500,
	    animate: {
		    props: ['opacity', 'width', 'height'],
		    opts: {
			    duration:400,
			    fps: 100,
			    transition: Fx.Transitions.sineOut
		    }
	    }
    });
    
    RenderBreadCrumb("breadCrumb");
});


/****************************************************************************************************************************************************************
*** Params
*** sElement - The name of the div to insert the rendered html
*** sParentZone - The Default Zone ID from the Ad Manager
*** sAdType - Passed to the Ad Tracker Web service with Enum { Default (Return a random ad based on Zone could not dependent on ad type.  Returns only one ad.)
***                                                             HTML (Return an html ad.  Can return multiple ads of the same type.)
***                                                             Image (Return an image ad.  Can return multiple ads of the same type.)
***                                                             Link (Returns a link ad.  Can return multiple ads of the same type.)
***                                                             Object (Returns a object(flash) ad.  Can return multiple ads of the same type.)
*** iAdCount - number of ads to be displayed in a zone
*****************************************************************************************************************************************************************/
function RenderZone(sElement, sParentZone, sAdType, iAdCount)
{
    //create our XmlHttpRequest object
    var oXmlHttp = createXmlHttpRequest();

    var sUrl = "/handlers/ZoneHandler.ashx?ParentZoneID=" + sParentZone +  "&AdType=" + sAdType + "&AdCount=" + iAdCount + "&PageUrl=" + window.location;    
    
    oXmlHttp.open("get", sUrl, true);	
    //create an event handler to deal with our request
    oXmlHttp.onreadystatechange = function(){
        if(oXmlHttp.readyState == 4)
	    {
	      if (oXmlHttp.status == 200)
	      {
	        var sResponse = oXmlHttp.responseText;	  	        
	        var oTarget = document.getElementById(sElement);            
            if(oTarget)
            {                
                oTarget.innerHTML = sResponse;
            }	        
	      }
	    }
    }
    
    oXmlHttp.send(null); 
}





