var SiteName = "wfmz.dayport.com";
var old,skn,iex=(document.all);
var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;
var x,y,image_left,image_top,msg;
document.onmousemove = mouseMoveHandler;
function dekInit()
{
var ns4=document.layers;
if (ns4)
skn=document.dek;
else if (ns6)
skn=document.getElementById("dek").style;
else if (ie4)
skn=document.all.dek.style;
if(ns4)
document.captureEvents(Event.MOUSEMOVE);
else
{
skn.visibility="visible";
skn.display="none";
}
}
function mouseMoveHandler (evt) {
x=(ns4||ns6)?evt.pageX:event.x+document.body.scrollLeft;
y=(ns4||ns6)?evt.pageY:event.y+document.body.scrollTop;
}
function killPopup(){
if(ns4){
skn.visibility="hidden";
}
else if (ns6||ie4)
skn.display="none";
}
function popup(msg,id){
// Pre-load the popup image
popupimg = new Image();
popupimg.src=msg;
msg = "
";
image_object = 'preview_' + id;
var content="
";
// Display popup according to where the original image lives
if (ns4) {
element = eval('document.' + image_object);
// First handle the vertical placement
pageheight = top.document.height;
image_top = element.y;
if (pageheight > (image_top + element.height + popupimg.height + 2))
image_top += element.height + 2; // Added the + 2 to make images line up better
else
image_top = image_top - popupimg.height - 2; // Place the popup image above the other image
// Now handle horizontal placement
pagewidth = top.document.width
image_left = element.x; // - 2; // Add the - 2 to make the images line up better
if (pagewidth < (image_left + popupimg.width))
image_left = image_left - (popupimg.width - element.width) // Pin to bottom-right corner
else
image_left = image_left - 2; // Pin to bottom-left corner, add the - 2 to make the images line up better
}
else {
// First handle the vertical placement
pageheight = document.body.scrollHeight;
image_top = document.getElementById(image_object).offsetTop;
tempEl1 = document.getElementById(image_object).offsetParent;
while (tempEl1 != null) {
image_top += tempEl1.offsetTop;
tempEl1 = tempEl1.offsetParent;
}
// Check if there's room to put it underneath
if (pageheight > (image_top + document.getElementById(image_object).height + popupimg.height + 4))
image_top += document.getElementById(image_object).height + 4;
else
image_top = image_top - popupimg.height - 2; // place the popup image above the other image
// Now handle horizontal placement
pagewidth = document.body.scrollWidth;
image_left = document.getElementById(image_object).offsetLeft;
tempEl2 = document.getElementById(image_object).offsetParent;
while (tempEl2 != null) {
image_left += tempEl2.offsetLeft;
tempEl2 = tempEl2.offsetParent;
}
if (pagewidth < (image_left + popupimg.width))
image_left = image_left - (popupimg.width - document.getElementById(image_object).width); // Pin to bottom-right corner
else
image_left += 0; // Pin to bottom-left corner
}
skn.top = image_top;
skn.left= image_left;
if(ns4){
skn.document.write(content);
skn.document.close();
skn.visibility="visible";
}
if(ns6){
document.getElementById("dek").innerHTML=content;
skn.display='';
}
if(ie4){
document.all("dek").innerHTML=content;
skn.display='';
}
}
function checkLaunch()
{
// strip off the URL parameters
var url_params = window.location.search.substr(1);
var custID = "";
var contID = "";
var template = "wfmzviewer.tpl";
var CatID = "";
var artID = "";
// alert("when is this being called")
if (url_params != '')
{
// alert(url_params);
var url_param_array = url_params.split('&');
var url_param_count = url_param_array.length;
var temp;
for(var count = 0; count < url_param_count; count++)
{
//alert(url_param_array[count]);
temp = url_param_array[count].split('=');
//alert(temp[0]); alert(temp[1]);
if (temp[0] == 'tf'){
template = temp[1];
}else if (temp[0] == 'Category_ID'){
CatID = temp[1];
}
else if (temp[0] == 'Customer_ID')
custID = temp[1];
else if (temp[0] == 'Contract_ID')
contID = temp[1];
else if (temp[0] == 'artID')
artID = temp[1];
}
}
//alert(window.location.href);
var url_regex = window.location.href.replace(/http:\/\//g,"");
//alert(url_regex);
var url_array = url_regex.split("/");
if (artID != "")
{
LaunchSyndicateArticle(artID);
window.location='http://www.wfmz.com/';
}
/*
if (url_array[1])
{
if (url_array[2])
{
if((url_array[1]=='launcher') && (url_array[2]!=''))
{
//alert('calling LaunchSyndicateArticle with '+url_array[2]+template);
//LaunchSyndicateArticle(url_array[2],template,custID,contID,CatID);
LaunchSyndicateArticle(url_array[2]);
window.location='http://www.wfmz.com/';
}
}
}
*/
}
function BuildVideoLink(type,hasvideo,article,articlename)
{
// If this article does not have video, stop right now
if (hasvideo == 'false')
return true;
// Setup the values to be used in the strings
var LinkText = 'View Video of the ' + articlename + ' story';
var VideoImage = 'http://wfmzimg.dayport.com/img/video1.gif';
var VideoText = 'Watch video';
switch(type)
{
case "image":
var LinkValue = '
';
break;
case "text":
var LinkValue = VideoText;
break;
case "combo":
var LinkValue = VideoText + '
';
break;
default:
return false;
break;
}
document.write(' ');
document.write(LinkValue);
document.write('');
return true;
}
function FormattedDate(created_def)
{
created_arr2 = created_def.split(" ");
created_arr = created_arr2[0].split("-");
montharg = created_arr[0] - 1;
created = new Date(created_arr[2], montharg, created_arr[1]);
switch(created.getDay())
{
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
break;
}
document.write("" + day + ", " + created_arr[0] + "/" + created_arr[1] + "/" + created_arr[2] + "");
return true;
}
function rtnElem(elemName, addStyle, isParent, parentID)
{
//alert("in rtnElem()");
var elemObj;
var styleStr = '';
if (addStyle)
styleStr = '.style';
if (ie4)
elemObj = eval('document.all.' + elemName + styleStr);
else if (ns6)
elemObj = eval('document.getElementById("' + elemName + '")' + styleStr);
else if (ns4)
{
if (isParent)
elemObj = eval('document.' + elemName);
else
elemObj = eval('document.' + parentID + '.document.' + elemName);
}
return elemObj;
}
function changeDivPosition(divID,newleft,newtop)
{
var tempElemObj = rtnElem(divID, true, true);
if (tempElemObj)
{
//alert("Yep");
var newContent = "";
tempElemObj.left = newleft;
tempElemObj.top = newtop;
return true;
}
else
{
//alert("Nope");
return false;
}
}
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("You have entered an invalid email address.")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("You have entered an invalid email address.")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("You have entered an invalid email address.")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
alert("You have entered an invalid email address.")
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("You have entered an invalid email address.")
return false
}
if (str.indexOf(dot,(lat+2))==-1){
alert("You have entered an invalid email address.")
return false
}
if (str.indexOf(" ")!=-1){
alert("You have entered an invalid email address.")
return false
}
return true
}
function validateMyForm()
{ var emailID=document.forms[0].email
if (document.forms[0].fname.value == "")
{alert('Please enter a first name.');
document.forms[0].fname.focus();
return(false)
}
if (document.forms[0].lname.value =="")
{alert('Please enter a last name.');
document.forms[0].lname.focus();
return(false)
}
if ((emailID.value==null)||(emailID.value=="")){
alert("Please enter an email address.");
emailID.focus();
return(false)
}
if (echeck(emailID.value)==false)
{emailID.value="";
emailID.focus();
return(false)
}
}