//--------------------- Last Modified --> 2006.11.10 ---------------------//
//------------------------------------------------------------------------------------//
//-----------------------------------------------------------------------//
jQuery.noConflict();
jQuery(function() {
// hides the slickbox as soon as the DOM is ready
// (a little sooner than page load)
jQuery('#slickbox').hide();
// shows the slickbox on clicking the noted link  
jQuery('a#slick-down').click(function() {
 jQuery('#slickbox').slideDown('slow');
 return false;
});
// hides the slickbox on clicking the noted link  
jQuery('a#slick-up').click(function() {
 jQuery('#slickbox').slideUp('slow');
 return false;
}); 
});

//-------------- expanding videos --------------------------------//
	
//------------------- for clearing and replacing text in form input fields and textareas -------------------//
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}





//------------------- Form Validation -------------------//
function formCheck(formobj){
    // Enter name of mandatory fields
    var fieldRequired = Array("contact_email", "contact_first_name");
    // Enter field description to appear in the dialog box
    var fieldDescription = Array("Please enter your Email Address", "Please enter your Name");
    // dialog message
	
    var alertMsg = "Please complete the following fields:\n";
    
    var l_Msg = alertMsg.length;
    
    for (var i = 0; i < fieldRequired.length; i++){
        var obj = formobj.elements[fieldRequired[i]];
        if (obj){
            switch(obj.type){
            case "select-one":
                if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
                break;
            case "select-multiple":
                if (obj.selectedIndex == -1){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
                break;
            case "text":
            case "textarea":
                if (obj.value == "" || obj.value == null){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
                break;
			 case "checkbox":
                if (obj.checked == false || obj.checked == null){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
                break;	
			case "radio":
                if (obj.checked == 0 || obj.checked == null){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
                break;		
            default:
            }
            if (obj.type == undefined){
                var blnchecked = false;
                for (var j = 0; j < obj.length; j++){
                    if (obj[j].checked){
                        blnchecked = true;
                    }
                }
                if (!blnchecked){
                    alertMsg += " - " + fieldDescription[i] + "\n";
                }
            }
        }
    }

    if (alertMsg.length == l_Msg){
        return true;
    }else{
        alert(alertMsg);
        return false;
    }
}

