//*****************************************************************************
// Filename: openUP.js
// Description: This javascript function will open whatever url is passed in to
// it in a new pop-up window.
//

jQuery(document).ready(function() {
    jQuery('a.faqLink').click( function(){
        var ans = jQuery(this).attr('faqid');        
        jQuery(ans).slideToggle();
        
        if(jQuery(this).hasClass('faqLink')){
            jQuery(this).addClass('faqLinkClicked').removeClass('faqLink');
        }else{
            jQuery(this).removeClass('faqLinkClicked').addClass('faqLink');
        }
    });
    /*
    jQuery('span.hdnEmail').click( function(){
        if(jQuery(this).attr("c") && jQuery(this).attr("d")){
            var email = jQuery(this).attr("c") + jQuery(this).attr("d") + "@up.edu";
            jQuery(this).replaceWith("<a href='mailto:"+email+"'>"+email+"</a>");
        }else{
            jQuery(this).replaceWith("No email address available");
        } 
        
    });
    */
    jQuery('span.hdnEmail').hover( 
        function(){
            if(jQuery(this).attr("c") && jQuery(this).attr("d")){
                var email = jQuery(this).attr("c") + jQuery(this).attr("d") + "@up.edu";
                jQuery(this)
                    .html("<a href='mailto:"+email+"'>"+email+"</a>")
                    .removeClass("hasEmailIcon")
                ;
            }else{
                jQuery(this)
                    .html("Not available")
                    .removeClass("hasEmailIcon")
                ;
            } 
        
        },
        function(){
            jQuery(this)
                .html("")
                .addClass("hasEmailIcon")
            ;
        }
    
    );
    
});


function openUP(path){
	var n=new Date();
	
	var subwindow = window.open(path, "newWin"+n.getTime() , "resizable=yes,scrollbars=yes,toolbar=yes,location=yes,status=yes,width=760,height=600", true)
	
	if (subwindow.opener == null) {
		subwindow.opener = self
	}
}
function openup(path){
	var n=new Date();
	
	var subwindow = window.open(path, "newWin"+n.getTime() , "resizable=yes,scrollbars=yes,toolbar=yes,location=yes,status=yes,width=760,height=600", true)
	
	if (subwindow.opener == null) {
		subwindow.opener = self
	}
}

//*******************************************************************************
// Function Name: toggle
// Description: This javascript function shows/hides FAQs on click
//
function toggle (r)
//used by faqs
{
    var row = document.getElementById(r);

    if (row.style.display == '') {
	    row.style.display = 'none';
	}
    else {
	    row.style.display = '';
	}
}
