<!--

/**  Function: null clearInput(ele, val)
*    ---------------------------------------------------------------- 
*    Purpose:           clear an input
*    Arguments:         ele         - str, the name of the element to clear
*                       val         - str, the default value that should be cleared
*    Returns/Assigns:   none
*/

function clearInput(ele, val){
    if(ele.value == val){
        ele.value='';
    }
}


/**  Function: null openWin(windowURL, windowName, windowFeatures)
*    ---------------------------------------------------------------- 
*    Purpose:           opens a new window and sets its properties
*    Arguments:         windowURL           - str, the url
*                       windowName          - str, the window name
*                       windowFeatures      - str, the features of the window
*    Returns/Assigns:   none
*/

function openWin(windowURL, windowName, windowFeatures){
    window.open(windowURL, windowName, windowFeatures);
}


/**  Function: null writeEmail(user, domain, subject, text)
*    ---------------------------------------------------------------- 
*    Purpose:           writes an email address in a mailto link
*                       if no 'text' is supplied it just writes the <a href="mailto:user@domain">
*                       if 'text' is supplied it writes <a href="mailto:user@domain">text</a>
*                       if 'subject' is supplied it writes <a href="mailto:user@domain?subject=subject">text</a>
*    Arguments:         user            - str, the username for the email address
*                       domain          - str, the domain name of the email address
*                       subject         - str, any subject line required
*                       text            - str, text for the link
*    Returns/Assigns:   writes a mailto link
*/

function writeEmail(user, domain, subject, text){
    // open up a mailto and combine the user and domain into an email address
    document.write('<a href="mailto:' + user + '@' + domain);
    if(subject){
        // if there's a subject tack it on
        document.write('?subject=' + subject);
    }
    document.write('">');
    if(text){
        // if there's text for the link add it and close the link
        document.write(text + '</a>');
    }
}


/**  Function: null addToFavourites()
*    ---------------------------------------------------------------- 
*    Purpose:           add a link or text for adding to favourites
*    Arguments:         none
*    Returns/Assigns:   writes html to screen
*/

function addToFavourites(){
    if(document.all){
        document.write('<a href="javascript:window.external.AddFavorite(document.location.href, document.title);" class="book">Bookmark</a>'); 
    } else{ 
        document.write('<span class="book">Press Ctrl+D to bookmark</span>');
    }
}


/**  Function toggleClass()
 *   -----------------------------------------------------------------
 *   Purpose:           Add/remove a css class to an element, without resorting to JQuery
 *   Arguments:         obj_id         - Element id to modify
 *                      cls            - String class to add/remove
 *   Returns:           false on successs, true on failure (for use within onClick) */

function addClass(obj_id, cls) {
    if(!document.getElementById) return true; // Browser too old, just execute the link
    var objElement = document.getElementById(obj_id);
    if ( objElement.className ) {
        var arrList = objElement.className.split(' ');        
        
        var found = false;
        for ( var i = 0; i < arrList.length; i++ ) {
            if ( arrList[i] == cls ) {
                arrList.splice(i, 1);
                found = true;
                i--;
            }
        }
        if(!found) {
            arrList[arrList.length] = cls;
        }
        objElement.className = arrList.join(' ');
    } else {
        objElement.className = cls;
    }
    return false;
}

function showExternalContent(num){
	document.getElementById('movieBox'+num).style.display = "block";
	document.getElementById('imageBox'+num).style.display = "none";	
}


// -->