// LOADING DAY SPECIFIC CSS
dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
dayNumber = new Date().getDay();

// LOADING DAY AND DATE
var months = new Array(
"January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December");
var weekdays = new Array(
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday");
var currentTime = new Date();
var month = currentTime.getMonth();
var days = currentTime.getDay();
var day = currentTime.getDate();
var year = currentTime.getFullYear();

//TESTIMONIAL POP UP WINDOW IN MIDDLE OF SCREEN
function popupWin(w,h,page)
{
    var wide = w;
    var high = h;
    
    screen_height = window.screen.availHeight;
    screen_width = window.screen.availWidth; 

    left_point = parseInt(screen_width/2)-(wide/2); 
    top_point = parseInt(screen_height/2)-(high/2); 

    win = window.open(page, 'win', 'width='+wide+',height='+high+',left='+left_point+',top='+top_point+',toolbar=no,location=no,scrollbars=no,status=no,resizable=no,fullscreen=no');
	//make sure your window is in the front 
    win.focus(); 
}

//PRINT LINK
var addPrintLink = {
init:function(sTargetEl,sLinkText) {
if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
if (!document.getElementById(sTargetEl)) {return;} // Check that the target element actually exists
if (!window.print) {return;} // Make sure the browser supports window.print
var oTarget = document.getElementById(sTargetEl);
var oLink = document.createElement('a');
oLink.id = 'print-link'; // Give the link an id to allow styling
oLink.href = '#'; // Make the link focusable for keyboard users
oLink.appendChild(document.createTextNode(sLinkText));
oLink.onclick = function() {window.print(); return false;} // Return false prevents the browser from following the link and jumping to the top of the page after printing
oTarget.appendChild(oLink);
}

};
//addPrintLink.addEvent(window, 'load', function(){addPrintLink.init('article','Print this page');});


function editorialFeaturesLogin() {

var password = 'classified';

if (this.document.login.pass.value == password) {
  top.location.href="editorial_features.html";
}
else {
  location.href="password_incorrect.html";
  }
}

// SHOW HIDE CONTACTS
function SeeMore(tid1,tid2,tid3) {
document.getElementById(tid1).style.display = "none";
document.getElementById(tid2).style.display = "";
document.getElementById(tid3).style.display = "";
}
function SeeLess(tid1,tid2,tid3) {
document.getElementById(tid1).style.display = "none";
document.getElementById(tid2).style.display = "none";
document.getElementById(tid3).style.display = "";
}

// CAREER MAIL EMAIL URL
function CMMail(){
location.href="mailto:?subject=" + escape("Career Mail Testimonial") + "&body=" + escape("This is the link for the Career Mail Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// EDUCATION & COURSES EMAIL URL
function ECMail(){
location.href="mailto:?subject=" + escape("Education & Courses Testimonial") + "&body=" + escape("This is the link for the Education & Courses Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// FRANCHISING & BUSINESS EMAIL URL
function FBMail(){
location.href="mailto:?subject=" + escape("Franchising Business Testimonial") + "&body=" + escape("This is the link for the Franchising & Business Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// GARDENING TMOS EMAIL URL
function G_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday Gardening Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday Gardening Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// GOOD HEALTH EMAIL URL
function GHMail(){
location.href="mailto:?subject=" + escape("Good Health Testimonial") + "&body=" + escape("This is the link for the Good Health Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// HEALTH TMOS EMAIL URL
function H_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday Health Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday Health Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// HOMES & GARDENS EMAIL URL
function HGMail(){
location.href="mailto:?subject=" + escape("Homes & Gardens Testimonial") + "&body=" + escape("This is the link for the Homes & Gardens Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// INTERIORS EMAIL URL
function IMail(){
location.href="mailto:?subject=" + escape("Interiors Testimonial") + "&body=" + escape("This is the link for the Interiors Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// INTERIORS TMOS EMAIL URL
function I_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday Interiors Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday Interiors Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// MAIL ORDER EMAIL URL
function MOMail(){
location.href="mailto:?subject=" + escape("Mail Order Testimonial") + "&body=" + escape("This is the link for the Mail Order Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// MAIL ORDER TMOS EMAIL URL
function MO_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday Mail Order Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday Mail Order Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// MOBILITY EMAIL URL
function MOBMail(){
location.href="mailto:?subject=" + escape("Mobility Testimonial") + "&body=" + escape("This is the link for the Mobility Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// MOBILITY TMOS EMAIL URL
function MOB_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday Mobility Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday Mobility Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// MORTGAGES & LOANS EMAIL URL
function MLMail(){
location.href="mailto:?subject=" + escape("Mortgages & Loans Testimonial") + "&body=" + escape("This is the link for the Mortgages & Loans Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// MOTORS EMAIL URL
function MOTMail(){
location.href="mailto:?subject=" + escape("Motors Testimonial") + "&body=" + escape("This is the link for the Motors Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// OVERSEAS PROPERTY EMAIL URL
function OPMail(){
location.href="mailto:?subject=" + escape("Overseas Property Testimonial") + "&body=" + escape("This is the link for the Overseas Property Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// OVERSEAS PROPERTY TMOS EMAIL URL
function OP_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday Overseas Property Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday Overseas Property Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// OVERSEAS TRAVEL EMAIL URL
function OTMail(){
location.href="mailto:?subject=" + escape("Overseas Travel Testimonial") + "&body=" + escape("This is the link for the Overseas Travel Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// OVERSEAS TRAVEL TMOS EMAIL URL
function OT_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday Overseas Travel Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday Overseas Travel Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// UK PROPERTY EMAIL URL
function UKPMail(){
location.href="mailto:?subject=" + escape("UK Property Testimonial") + "&body=" + escape("This is the link for the UK Property Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// UK PROPERTY TMOS EMAIL URL
function UKP_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday UK Property Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday UK Property Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// UK TRAVEL EMAIL URL
function UKTMail(){
location.href="mailto:?subject=" + escape("UK Travel Testimonial") + "&body=" + escape("This is the link for the UK Travel Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// UK TRAVEL TMOS EMAIL URL
function UKT_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday UK Travel Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday UK Travel Testimonial:\n" + location.href +"\n\n\n");
return false;
}
// YOU GALLERY EMAIL URL
function YG_tmosMail(){
location.href="mailto:?subject=" + escape("The Mail on Sunday You Gallery Testimonial") + "&body=" + escape("This is the link for The Mail on Sunday You Gallery Testimonial:\n" + location.href +"\n\n\n");
return false;
}

// CONTACT FORM VALIDATION
function validate_contact_us ( )
{
	valid = true;
        if ( document.contact_us_form.name.value == "" )
        {
                alert ( "Please fill in your name" );
                valid = false;
        }

        if ( document.contact_us_form.email.value == "" )
        {
                alert ( "Please fill in your email address" );
                valid = false;
        }
		
		if ( document.contact_us_form.company.value == "" )
        {
                alert ( "Please fill in your company name" );
                valid = false;
        }
		
		if ( document.contact_us_form.message.value == "" )
        {
                alert ( "Please fill out a message" );
                valid = false;
        }
        return valid;
}
// SHOW/HIDE CONTACT DIVS
function hideDIV(d) { document.getElementById(d).style.display = "none"; }
function displayDIV(d) { document.getElementById(d).style.display = "block"; }

//SHOW/HIDE FOR FAQ's
function unhide(divID) {
  var item = document.getElementById(divID);
  if (item) {
    item.className=(item.className=='hidden')?'unhidden':'hidden';
  }
}

// FRANCHISE COMPETITION EMAIL URL
function FranchiseLink(){
location.href="mailto:?subject=" + escape("Daily Mail Franchising Competition") + "&body=" + escape("This is the link for the Daily Mail Franchising Competition:\n" + location.href +"\n\n\n");
return false;
}