﻿function LoadCustomMTip(type,title,titleClr,titleBgClr,tipClr,tipBgClr,wWidth,wHeight)
{
    // Variable Declaration
    var output = '';
    var textColorName = '';
    var textBgColorName = '';
    
    // Determining tip height & widths
    var tipWidth;
    var tipHeight;
    
    // Getting color codes without # symbol
    if (tipClr.indexOf('#')>-1)
        textColorName = tipClr.substring(1, tipClr.length);
    
    if (tipBgClr.indexOf('#')>-1)
        textBgColorName = tipBgClr.substring(1, tipBgClr.length);
    
    // Preparing the custom moving tip widget structure
    
    if (type == "1")
    {
        tipWidth = wWidth - 16;
        tipHeight = wHeight - 68;
        output = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="0" cellpadding="0">';
        output = output + '<tr><td height="30" style="font-family:Arial; font-size:15px;font-weight:bold; background-color:' + titleBgClr + '; color:' + titleClr + '; text-align:center;">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td height="' + (wHeight - 68) + '" style="font-family:Arial; font-size:11px; padding:8px; border-top:#FFFFFF solid 1px; border-bottom:#FFFFFF solid 1px; background-color:'+ tipBgClr +'; color:' + tipClr + ';" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;background-color:#' + textBgColorName + ';overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="20" style=" height:20px; font-family:Arial; background-color:' + titleBgClr + '; color:' + titleClr + '; font-size:10px;text-align:center;">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + titleClr + '; text-decoration:none;">Movers.com</a></td></tr></table>';
    }
    else if (type == "2")
    {
        tipWidth = wWidth - 20;
        tipHeight = wHeight - 74;
        output = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="0" cellpadding="0">';
        output = output + '<tr><td style="border:' + titleBgClr + ' solid 1px;"><table width="' + (wWidth - 2) + '" height="' + (wHeight - 2)+ '" border="0" cellspacing="0" cellpadding="0" style="border:#ffffff solid 1px;">';
        output = output + '<tr><td height="30" style="background-color:' + titleBgClr + ';font-family:Arial; font-size:15px;font-weight:bold; color:' + titleClr + '; text-align:center;">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td height="' + (wHeight - 74)+ '" style="font-family:Arial; font-size:11px; background-color:'+ tipBgClr +'; color:' + tipClr + '; padding:8px;" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="24" style=" background-color:' + titleBgClr + '; font-family:Arial; color:' + titleClr + '; font-size:10px;text-align:center;">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + titleClr + '; text-decoration:none;">Movers.com</a></td></tr></table></td></tr></table>';
    }
    else if (type == "3")
    {
        tipWidth = wWidth - 24;
        tipHeight = wHeight - 70;
        output  = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="0" cellpadding="0"  style="border:' + titleBgClr + ' double 3px;">';
        output = output + '<tr><td><table width="' + (wWidth - 6) + '" height="' + (wHeight - 6) + '" border="0" cellspacing="0" cellpadding="0" bgcolor=' + tipBgClr + ' style="border:' + titleBgClr + ' solid 4px;">';
        output = output + '<tr><td height="26" style="font-family:Arial; font-size:15px;font-weight:bold; color:' + titleClr + '; text-align:center;">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td height="' + (wHeight - 70) + '" style="font-family:Arial; font-size:11px;color:' + tipClr + '; padding:5px;" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="20" style="font-family:Arial; color:' + titleClr + ';font-size:10px;text-align:center;">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + titleClr + '; text-decoration:none;">Movers.com</a></td></tr></table></td></tr></table>';
    }
    else if (type == "4")
    {
        tipWidth = wWidth - 22;
        tipHeight = wHeight - 72;
        output  = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="0" cellpadding="0" style="border:'+ tipBgClr +' double 3px;">';        
        output = output + '<tr><td height="30" style="font-family:Arial;font-size:15px;font-weight:bold; background-color:' + titleBgClr + '; color:' + titleClr + ';text-align:center;">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td height="' + tipHeight + '" style="font-family:Arial; font-size:11px;color:' + tipClr + '; padding:8px; background-color:'+ tipBgClr +';" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="20" style="font-family:Arial;background-color:' + titleBgClr + ';color:' + titleClr + ';font-size:10px;text-align:center;">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + titleClr + '; text-decoration:none;">Movers.com</a></td></tr></table>';
    }
    else if (type == "5")
    {
        tipWidth = wWidth - 20;
        tipHeight = wHeight - 72;
        output  = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="1" cellpadding="0" style="border:'+ titleBgClr +' solid 1px;">';
        output = output + '<tr><td height="30" style="font-family:Arial; font-size:15px;font-weight:bold;color:' + titleClr + ';background-color:'+ titleBgClr +';text-align:center;">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td height="' + tipHeight + '" style="font-family:Arial;font-size:11px;color:' + tipClr + ';padding:8px;background-color:'+ tipBgClr +';" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="20" style="font-family:Arial;color:' + titleClr + ';background-color:'+ titleBgClr +';font-size:10px;text-align:center;">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + titleClr + '; text-decoration:none;">Movers.com</a></td></tr></table>';
    }
    else if (type == "6")
    {
        tipWidth = wWidth - 16;
        tipHeight = wHeight - 75;
        output = '<table width="' + wWidth + '" height="' + wHeight + '"  border="0" cellspacing="0" cellpadding="0"><tr><td height="30" style="background-color:'+ titleBgClr +'; font-family:Arial; font-size:15px;font-weight:bold; color:' + titleClr + '; text-align:center;">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td height="' + tipHeight + '" style="font-family:Arial; font-size:11px;color:' + tipClr + '; padding:8px; background-color:'+ tipBgClr +';" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="28" align="right" bgcolor="#FFFFFF" style=" border-bottom:'+ tipBgClr +' solid 1px; border-left:'+ tipBgClr +' solid 1px; border-right:'+ tipBgClr +' solid 1px; font-family:Arial; font-size:10px; color:#000000;">Powered by <a href="http://www.movers.com" target="_blank" ><img src="http://www.movers.com/images/cn/mclogo.gif" width="100" height="28" border="0" align="absmiddle" /></a></td></tr></table>';
    }
    else if (type == "7")
    {
        tipWidth = wWidth - 20;
        tipHeight = wHeight - 70;
        output = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="0" cellpadding="0">';
        output = output + '<tr><td height="30" style="background-color:'+ titleBgClr +'; font-family:Arial; font-size:15px;font-weight:bold; color:' + titleClr + '; text-align:center; border-xbottom:#FFFFFF solid 1px;">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td style="border:'+ titleBgClr +' solid 1px;"><table width="' + wWidth + '" border="0" cellspacing="0" cellpadding="0" style="border:#ffffff solid 1px; background:' + tipBgClr + ';">';
        output = output + '<tr><td height="' + tipHeight + '" style="font-family:Arial; font-size:11px;color:' + tipClr + '; padding:8px;" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="24" style="font-family:Arial; color:' + tipClr + '; font-size:10px; text-align:center;">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + tipClr + '; text-decoration:none;">Movers.com</a></td></tr></table></td></tr></table>';
    }
    else if (type == "8")
    {
        tipWidth = wWidth - 16;
        tipHeight = wHeight - 74;
        output = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="0" cellpadding="0"><tr><td  height="30" style="border-bottom:#FFFFFF solid 1px; font-family:Arial; font-size:16px; font-weight:bold; color:' + titleClr + '; text-align:center; background:'+ titleBgClr +';">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td height="1" bgcolor=' + titleClr + '></td></tr><tr><td height="' + tipHeight + '" style="font-family:Arial; font-size:11px;color:' + tipClr + '; padding:8px; border-top:#FFFFFF solid 1px; border-bottom:#FFFFFF solid 1px; background-color:'+ tipBgClr +';" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="24" style="font-family:Arial; color:'+ titleClr +'; font-size:10px; text-align:center; background:'+ titleBgClr +';">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + titleClr + '; text-decoration:none;">Movers.com</a></td></tr></table>';
    }
    else if (type == "9")
    {
        tipWidth = wWidth - 16;
        tipHeight = wHeight - 71;
        output = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="0" cellpadding="0"><tr><td height="30" style="border-bottom:#FFFFFF solid 1px; background-color:'+ titleBgClr +'; font-family:Arial; font-size:16px; font-weight:bold; color:'+ titleClr +'; text-align:center;">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td height="' + tipHeight + '" style="font-family:Arial; font-size:11px;color:'+ tipClr +'; padding:8px; background-color:'+ tipBgClr +';" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="24" style="font-family:Arial; color:'+ titleClr +'; font-size:10px; text-align:center; background:'+ titleBgClr +';">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + titleClr + '; text-decoration:none;">Movers.com</a></td></tr></table>';
    }
    else if (type == "10")
    {
        tipWidth = wWidth - 18;
        tipHeight = wHeight - 70;
        output = '<table width="' + wWidth + '" height="' + wHeight + '" border="0" cellspacing="0" cellpadding="0"><tr><td height="30" style="font-family:Arial; font-size:15px;font-weight:bold; color:' + titleClr + ';text-align:center; background:' + titleBgClr + '">'+ unescape(title) +'</td></tr>';
        output = output + '<tr><td  height="' + tipHeight + '" style="font-family:Arial; font-size:11px;color:' + tipClr + '; padding:8px; border-left:' + titleBgClr + ' solid 1px; border-right:' + titleBgClr + ' solid 1px; background-color:'+ tipBgClr +';" valign="top"><iframe src="http://www.movers.com/tips.aspx?txtcolor=' + textColorName + '&txtbcolor=' + textBgColorName + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" style="height:' + tipHeight + 'px;width:' + tipWidth + 'px;overflow:auto;"></iframe></td></tr>';
        output = output + '<tr><td height="24" style="font-family:Arial; color:'+ titleClr +'; font-size:10px; text-align:center; background:' + titleBgClr + ';">Powered by <a href="http://www.movers.com" target="_blank" style="color:' + titleClr + '; text-decoration:none;">Movers.com</a></td></tr></table>';
    }
    
    // Adding widget to the page
    document.getElementById("movingtip").innerHTML = output;
}

