﻿function DefBtnEvent(e, buttonid){var evt = e ? e : window.event;var bt = document.getElementById(buttonid);if (bt){if (evt.keyCode == 13){bt.click();return false;}}}
// Function to redirect to the url
function redir(url){window.location = url;}
function newwin(url){window.open(url,'','');}
// Displays a given div tag at the given position.
function ShowDiv(divId,top,left,pos){var divCtrl = document.getElementById(divId);divCtrl.style.position = "absolute";if(pos == 'center'){var point = window.center({width:top,height:left});divCtrl.style.top = point.y + "px";divCtrl.style.left = point.x + "px";}else{divCtrl.style.top = top + 'px';divCtrl.style.left = left + 'px';}divCtrl.style.display = '';}
// Displays a div tag for displaying the youtube video with the given width & heights at the center of the screen
function ShowVideo(vidDiv,vidName,vidUrl,vidWidth,vidHeight){var videoDiv = document.getElementById(vidDiv);var divWidth = vidWidth + 60;var divHeight = vidHeight + 65;var vidHtml = '<table width="' + divWidth + '" border="0" cellspacing="0" cellpadding="0" style="border:outset 4px #333333;background-color:#016aa1;"><tr><td align="right" height="30"><a href="javascript:CloseVideo(\'' + vidDiv + '\');" style="text-decoration:none;"><font face="Arial" color="#ffffff" size="1"><b>Close (X)</b></font></a>&nbsp;&nbsp;</td></tr><tr><td align="center"><object width="' + vidWidth + '" height="' + vidHeight + '"><param name="movie" value="' + vidUrl + '"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="' + vidUrl + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + vidWidth + '" height="' + vidHeight + '"></embed></object></td></tr><tr><td height="30" align="center"><font face="Arial" color="#ffffff" size="2"><b>' + vidName + '</b></font></td></tr></table>';videoDiv.innerHTML = vidHtml;ShowDiv(vidDiv,divWidth,divHeight,'center');}
// Hides a video div tag and removes all the html code inside the div tag.
function CloseVideo(vidDiv){document.getElementById(vidDiv).style.display = 'none';document.getElementById(vidDiv).innerHTML = '';}
// Returns the size of the browser window based on the browser and its mode.
window.size = function(){var w = 0;var h = 0;if(!window.innerWidth){if(!(document.documentElement.clientWidth == 0)){w = document.documentElement.clientWidth;h = document.documentElement.clientHeight;}else{w = document.body.clientWidth;h = document.body.clientHeight;}}else{w = window.innerWidth;h = window.innerHeight;}return {width:w,height:h};}
// Returns top & left position required to center a div tag in a browser window.
window.center = function(){var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:0};var _x = 0;var _y = 0;var offsetX = 0;var offsetY = 0;if(!window.pageYOffset){if(!(document.documentElement.scrollTop == 0)){offsetY = document.documentElement.scrollTop;offsetX = document.documentElement.scrollLeft;}else{offsetY = document.body.scrollTop;offsetX = document.body.scrollLeft;}}else{offsetX = window.pageXOffset;offsetY = window.pageYOffset;}_x = ((this.size().width-hWnd.width)/2)+offsetX;_y = ((this.size().height-hWnd.height)/2)+offsetY;return{x:_x,y:_y};}
// MovePlanner Login popup
function MPLogin() { var dvCtrl = document.getElementById('ctl00_cph_mp_imgLtCrv');  var curleft = 0, curtop = 0; if (dvCtrl.offsetParent) { while (dvCtrl.offsetParent) { curleft += dvCtrl.offsetLeft; curtop += dvCtrl.offsetTop; dvCtrl = dvCtrl.offsetParent; } } else { if (dvCtrl.x) { curleft += dvCtrl.x; } if (dvCtrl.y) { curtop += dvCtrl.y; } } document.getElementById('dvMP').innerHTML = '<table width="269" border="0" cellspacing="0" cellpadding="0" style="border:solid 3px #41B838;background-color:#fff;"><tr><td align="right"><a href="javascript:CloseVideo(\'dvMP\');" style="text-decoration:none;"><img src="http://www.movers.com/move-planner/images/close.gif" border="0"></a></td></tr><tr><td><iframe src="http://www.movers.com/move-planner/login.aspx" width="260" height="76" frameborder="0" scrolling="no" /></td></tr></table>'; ShowDiv('dvMP', curtop+45, curleft+16, ''); }
