//Global FooCo Javascript Properties and Methods - FooCo Ltd (c)

var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 24;
var MovieBase = 'http://www.fooco.co.uk/includes/flash/';

function HeaderLoginValidation(ctrlUsernameClient, ctrlPasswordClient)
{
    var Username = document.getElementById(ctrlUsernameClient);
    var Password = document.getElementById(ctrlPasswordClient);

    if (TrimAll(Username.value) == '' | TrimAll(Username.value) == 'Username')
    {
        Username.focus();
        alert('Please specify a valid username');
        return false;
    }
    
    if (TrimAll(Password.value) == '' | TrimAll(Password.value) == 'Password')
    {
        Password.focus();
        alert('Please specify a valid password');
        return false;
    }
    
    return true;
}

function SearchValidation(ctrlSearchClient)
{
    var Search = document.getElementById(ctrlSearchClient);

    if (TrimAll(Search.value) == '')
    {
        Search.focus();
        alert('Please specify a valid search term');
        return false;
    }
    
    return true;
}

function ReferFriendValidation(ctrlSenderEmailClient, ctrlFriendEmailClient)
{
    var Sender = document.getElementById(ctrlSenderEmailClient);
    var Friend = document.getElementById(ctrlFriendEmailClient);
    
     var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
     var regex = new RegExp(emailReg);


    if (TrimAll(Sender.value) == '' | TrimAll(Sender.value) == 'Your E-Mail Address' || !regex.test(Sender.value))
    {
        Sender.focus();
        alert('Your E-Mail Address appears to be invalid.');
        return false;
    }     
    
    if (TrimAll(Sender.value) == '' | TrimAll(Sender.value) == 'Friends E-Mail Address' || !regex.test(Friend.value))
    {
        Friend.focus();
        alert('Your Friend/Collegues E-Mail Address appears to be invalid.');
        return false;
    }
    
    return true;
}

function Bind_LatestVideo_Complete()
{
   document.getElementById('LatestVideos_Preloader').style.display = 'none';
}

function Bind_LatestVideo_Load(ctrlSubmitClient)
{
   document.getElementById('LatestVideos_Preloader').style.display = 'inline';
   
   if (IsDomReady)
   {
        setTimeout("Bind_LatestVideo('" + ctrlSubmitClient + "')",4000); 
   } 
   else
   {
        setTimeout("Bind_LatestVideo_Load('" + ctrlSubmitClient + "')",1500); 
   }
}

function Bind_LatestVideo(ctrlSubmitClient)
{
    var SubmitButton = document.getElementById(ctrlSubmitClient);
    
    if (SubmitButton.click)
        SubmitButton.click();
    else
    {
        var e = document.createEvent("MouseEvents");
        e.initEvent("click", true, true);
        SubmitButton.dispatchEvent(e);
    }

    document.getElementById('LatestVideos_Preloader').style.display = 'none';
}

function DisplayFeatureVideoPopup(name)
{
    var Callout = document.getElementById(name);
    Callout.style.left = tempX+ "px";
    Callout.style.top = tempY+ "px";
    Callout.style.visibility = "visible";
}

function HideFeatureVideoPopup(name)
{
     var Callout = document.getElementById(name);
     Callout.style.visibility = "hidden";
}

function DisplayFeatureVideoPopupDetail(LogoPath, ThumbPath, CompanyName, Location)
{
   var divCustomerDetails = document.getElementById('VideoCustomerDetails');
   var Logo = document.getElementById('imgLogo');
   var Thumbnail = document.getElementById('imgVideoThumbnail');
   
   divCustomerDetails.innerHTML = "";
   Logo.src = "";
   Thumbnail.src = "";
   
   divCustomerDetails.innerHTML = "<b>" + CompanyName + "</b><br/>" + 
   Location;
   
   Logo.src = LogoPath; 
   Thumbnail.src = ThumbPath;
}

function Enquiry_SendComplete()
{
    document.getElementById('tblEnquiryForm').style.display = "none";
     document.getElementById('EnquiryMessage').innerHTML = "<hr/><img src='../../images/site/SubmitSuccess_Enquiry.png' alt='' style='vertical-align: top;'>&nbsp;&nbsp;<b>Thank You, Enquiry Sent Successfully.</b><p>" + 
     "One of our highly skilled representatives will contact you shortly to discuss your enquiry in more detail.";
}
