
// Set up Accordion
window.addEvent('domready', function() {
	//create our Accordion instance
	var myAccordion = new Accordion($('accordion'), 'h3.toggler', 'div.element', {
		opacity: false,
        alwaysHide: true,
		onActive: function(toggler, element){
            if(!toggler.originalHTML)
                toggler.originalHTML = toggler.innerHTML;
			toggler.setStyle('color', '#EF8C4A');
            toggler.innerHTML = '<img src="/images/collapse.png" hspace="4" align="absmiddle" />' + toggler.originalHTML;
		},
		onBackground: function(toggler, element){
            if(!toggler.originalHTML)
                toggler.originalHTML = toggler.innerHTML;
			toggler.setStyle('color', '#30496F');
            toggler.innerHTML = '<img src="/images/expand.png" hspace="4" align="absmiddle" />' + toggler.originalHTML;
		}
	});
});

// Change Outbound Links
window.addEvent('domready', function() {  
    $$('a[href^=http]').each(function(el) {  
        if(
            el.hostname != 'www.cardomedical.com' 
            && el.hostname != 'cardomedical.com' 
            && el.hostname != 'cardomedical.ir.stockpr.com' 
            && el.hostname != 'www.cardomedical.ir.stockpr.com'
            && el.hostname != 'www.ckst.sites.stockpr.com'
            && el.hostname != 'content.stockpr.com'
            && el.hostname != 'app.quotemedia.com'
            || el.pathname.contains('media-center/view/1/wallst-tv---3-minute-press-show-interview-with-dr-andrew-brooks-ceo-of-cardo-medical')
            || el.pathname.contains('media-center/view/101/wallst-tv---3-minute-press-show-interview-with-dr-andrew-brooks-ceo-of-cardo-medical---october-30-2008')){
            el.addEvent('click',function() {
                //alert(el.get('href'));
                destination = el.getProperty('href');
                displayMessage(
                    '<h1 class="page-title">YOU ARE NOW LEAVING THE CARDO MEDICAL WEB SITE</h1>'
                    + '<p>Click the link below to continue or wait <strong>30 seconds</strong> to be transferred to:</p>'
                    + '<p><strong>Continue to: <a href="' + destination + '">' + destination + '</a></strong></p>'
                    
                    + '<p>We are providing links to this third party website <strong>' + destination + '</strong> '
                    + 'only as a convenience and the inclusion of links to the linked site does not imply any endorsement, approval,'
                    + 'investigation, verification or monitoring by us of any content or information contained within or accessible '
                    + 'from the linked site.&nbsp; Cardo Medical does not control the accuracy, completeness, timeliness or appropriateness'
                    + 'of the content or information on the linked site.  If you choose to visit the linked site you will be subject to '
                    + 'its terms of use and privacy policies, over which Cardo Medical has no control.&nbsp; In no event will Cardo Medical '
                    + 'be responsible for any information or content within the linked site or your use of the linked site.&nbsp; By continuing '
                    + 'to the linked site you agree to the foregoing.</p>    Thank you for visiting <strong>http://www.cardomedical.com</strong> '
                , false);
                setTimeout("window.location.href = destination",30*1000);
                return false;
            }.bind(this));  
        };
    });
}); 

messageObj = new DHTML_modalMessage();	// We only create one object of this class
messageObj.setShadowOffset(5);	// Large shadow

function displayMessage(messageContent,cssClass)
{
	messageObj.setHtmlContent(messageContent);
	messageObj.setSize(450,300);
	messageObj.setCssClassMessageBox(cssClass);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}

function closeMessage()
{
	messageObj.close();	
}
