
/* VSX AUTOMATION 1.0 FUNCTIONS */
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);



function go(page) 
{
 window.location=page;
}



// ********** AUTO CENTERING POP UP ****************** //
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}



function exportList(listid)
{
url = './cgi/qry_export_list.cfm?listid=' + listid;
NewWindow(url,'ExportList','500','500','1');
}

// MAKE SURE A NAME IS SUBMITTED 
function checkListName() 
{
if (document.createListForm.list_name.value == "") {
 alert("Please enter a name for your new list.\t");
 return false; }
}

// CHECK FOR VALID EMAIL ADDRESS
function check_email(e) {
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

for(i=0; i < e.length ;i++){
if(ok.indexOf(e.charAt(i))<0){ 
return (false);
}	
} 

if (document.images) {
re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
if (!e.match(re) && e.match(re_two)) {
return (-1);		
 } 
}

}

function checkEmailAddr()
{
if(document.addEmailForm.email.value.length < 1){
alert("You entered less than one character in the email address field.");
document.addEmailForm.email.focus(); // put the prompt in the name field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
document.addEmailForm.email.style.background = "#ffff00";
}
// make sure the form is not submitted
return false;
}

// check the first email address ( the exclamation means "not" )
if(!check_email(document.addEmailForm.email.value)){
alert("Invalid email detected.");
document.addEmailForm.email.focus();
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
document.addEmailForm.email.style.background = "#ffff00";
// make sure the form is not submitted
return false;
 }
}
}

// CONFIRM LIST DELETION 
function confirmDelete(listid)
{
result = window.confirm('Are you sure you want to delete this list?\t');

if (result){
 window.location='./cgi/qry_delete_list.cfm?listid=' + listid;
  }
}

// PASTE IMPORT LIST FUNCTION, CHECKS TO SEE THE FORM CONTAINS SOMETHING TO IMPORT
function pasteList() {
f = document.pasteForm;

if (f.emails.value == "") {
 alert("Your list does not contain any email addresses.\t\nPlease paste your list into the box provided.");
 return false;
}

}

// ***** LIST MERGE FUNCTION ******* //
function checkMerge(){
var chkbox = document.forms[0].listid;
var n = false;
var x = 0;

for(i=0;i<chkbox.length;i++){  
   if(chkbox[i].checked==true){
   n=true;
   x++;
   } 
 }

if(!n){
 alert("Please select two or more lists to merge.   ");
 return false;
}

if(x<2){
 alert("Great! Now select at least one more subscriber list. ");
 return false;
 }
}



function Active(){
var chkbox = document.forms[0].emailid;
var n = "";
var x = false;


for(i=0;i<chkbox.length;i++){  
   if(chkbox[i].checked==false){
   n=n + chkbox[i].value + ",";
   x=true;
   } 
 }

if(x==true){
document.forms[0].deactivate.value=n;
}
}






function submitCutPaste(){
if(document.forms[0].MESSAGE_HTMBODY.value == ""){
alert("Please enter your HTML content.   ");
document.forms[0].MESSAGE_HTMBODY.focus();
return false;
 } 

if(document.forms[0].MESSAGE_TXTBODY.value == ""){
alert("Please enter your TEXT content.   ");
document.forms[0].MESSAGE_TXTBODY.focus();
return false;
}
}



// CONFIRM SUBSCRIBER DELETION 
function deleteSubscriber(emailid,listid)
{

result = window.confirm('Are you sure you want to delete this subscriber?\t');

if (result){
 window.location='./cgi/qry_delete_subscriber.cfm?emailid=' + emailid + '&listid=' + listid;
}
  
}


function countSubscribers(){
	f = document.forms[0];	
	j = 0;
	var contacts = "";
	var message = "Please select a list.        ";
	
	
if(typeof f.listid.length == 'undefined') {
   if(f.listid.checked == true) {
		contacts = f.listid.value; 
		j = j + 1;
	}
} 

else {
	
	for ( i = 0; i < f.listid.length; i++ ) {
		if(f.listid[i].checked == true) {			
			contacts += f.listid[i].value + ",";
			j = j + 1;
		}		
	}
}

    if(j < 1){
		alert(message);
	} 
	else {
		
		//result = window.confirm("Are you sure you want to delete these contacts?            ");
		//if ( result ) {		
				url = 'act_list_count_subscribers.cfm?listid=' + contacts;
				NewWindow(url,'CountWindow','500','300','1');
		//}
	}
	

}


/* NO LONGER WORKING

function countSubscribers(){
var chkbox = document.forms[0].listid;
var listid = 0;

for(i=0;i<chkbox.length;i++){  
   if(chkbox[i].checked==true){
   listid=chkbox[i].value;
   } 
 }
 
url = 'act_list_count_subscribers.cfm?listid=' + listid;
NewWindow(url,'CountWindow','500','300','1');
}


*/



// ******************** START ACCOUNT FUNCTIONS ************************ // 
function acctModify(){
var f = document.forms[0];

result = window.confirm("Are you sure you want to modify your account?\t");

if(result){
	document.forms[0].submit();
} else { return false; }	

}

function acctChangePW(){
var f = document.forms[0];

if(f.user_password.value == ""){
alert("Please enter a new password.    ");
f.user_password.focus();
return false;
}

if(f.confirm_password.value == ""){
alert("Please retype your new password in the confirm password field.\t");
f.confirm_password.focus();
return false;
}

if(f.confirm_password.value != f.user_password.value) {
alert("Your passwords does not match. Please re-enter your password.\t");
f.confirm_password.value = "";
f.user_password.value = "";
f.user_password.focus();
return false;
}

}



function acctSettings(){
var f = document.forms[0];
var result;

// Need to have a from address
if(f.company_from_addr.value == ""){
alert("Please enter a From address.     ");
return false;
}


if(f.company_replyto_addr.value != ""){   
// check the first email address ( the exclamation means "not" )
if(!check_email(f.company_replyto_addr.value)){
alert("Invalid email detected.");
f.company_replyto_addr.focus();
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.company_replyto_addr.style.background = "#ffff00";
// make sure the form is not submitted
return false;
 }
}

}



}//end





function supportRequest(){
var f = document.forms[0];

if(f.name.value == ""){
alert("Please enter your name.     ");
f.name.focus();
return false;
}

if(f.email.value.length < 1){
alert("You entered less than one character in the email address field.");
f.email.focus(); // put the prompt in the name field 
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.email.style.background = "#ffff00";
}
// make sure the form is not submitted
return false;
}

// check the first email address ( the exclamation means "not" )
if(!check_email(f.email.value)){
alert("Invalid email detected.");
f.email.focus();
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
f.email.style.background = "#ffff00";
// make sure the form is not submitted
return false;
 }
}

if(f.problem_description.value == ""){
alert("Please tell us about the issue you are experiencing.");
f.problem_description.focus();
return false;
}


}//end



// ******************** END ACCOUNT FUNCTIONS ************************ // 



// MAKE SURE THERE IS A FILE TO UPLOAD
function upload(){

if (document.importForm.list_name.value == "") {
alert("Please enter a name for this list.\t");
document.importForm.list_name.focus();
return false;
}

if(document.importForm.list_file_name.value == ""){
alert("Please choose a file to upload. Click the \"Browse\" \nbutton for a .csv or .txt file on your computer.\t");
return false;
}
else
return true;
 }

 
// ************* CAMPAIGN FUNCTIONS ************8
//
// STEP 1
//
function isvalid() {
if (document.camForm1.campaign_name.value == "") {
  	alert('Please enter a name for your campaign.\t');
	return false;
 }
}

// STEP 2
function checkMailSettings() {
if (document.camForm2.message_sentfrom.value == "") {
	alert('Please enter the \"From\" address.\t');
    document.camForm2.message_sentfrom.focus();
    return false;
}


if (document.camForm2.message_replyto.value !== "") {
 // check the first email address ( the exclamation means "not" )
  isOkay = check_email(document.camForm2.message_replyto.value);
  
  if(!isOkay) {
  alert("Please enter a valid email address or leave blank.\t");
  document.camForm2.message_replyto.focus();
// if the browser is Netscape 6 or IE
if(document.all || document.getElementByID){
// change the color of text field
document.camForm2.message_replyto.style.background = "#ffff00";
// make sure the form is not submitted
return false;
  }
 }
}

if (document.camForm2.message_subject.value == "") {
	alert('Please enter the \"Subject Line\" of the email.\t');
    document.camForm2.message_subject.focus();
    return false;
}

}

	
// DELETE CAMPAIGN
function deleteCampaign(campaignid){
result = window.confirm('Are you sure you want to delete this campaign?\t');

if (result){
 window.location='./cgi/qry_delete_campaign.cfm?campaignid=' + campaignid;
  }
}


// CHECK SEND DATE SCHEDULE
function checkSendDate(){
var mydate = "";
var theday = "";
var dayOkay = "";
var GoodChars = "0123456789";

if(document.scheduleform.message_dtdeploy_date.value == ""){
alert("Please select a date to deliver your message.\t");
return false;
}
else {
  mydate = document.scheduleform.message_dtdeploy_date.value;
  theday = mydate.split("/");
  dayOkay = theday[2];  
}

if (dayOkay != "" && dayOkay > 28) {
result = window.confirm('You chose a day greater than the 28th. If you proceed your email will be\t\nautomatically set to the last day of every month. Do you wish to proceed?');

if (result){
}  
else {  
  return false; 
 }
}

if(document.scheduleform.ndays.value == ""){
alert("Please enter a number in the \"Deliver this message every n days\" field.   ");
return false;
}

/*if(document.scheduleform.ndays.value){
alert("You must enter a number greater than 0.  ");
return false;
}*/

if(document.scheduleform.ndays.value!=""){
    var ThisUnit = document.scheduleform.ndays.value;
    valid = 1;
	
	for (i =0; i <= ThisUnit.length -1; i++) {
		if (GoodChars.indexOf(ThisUnit.charAt(i)) == -1) {
// Note: Remove the comments from the following line to see this
// for loop in action.
// alert(TheNumber.charAt(i) + " is no good.")
            alert("Please enter a valid number.   ");
			document.scheduleform.ndays.focus();
			return false;
			valid = 0
		} // End if statement
	} // End for loop
	
if(valid<1){ 
   return false;
}
	
}


if(document.scheduleform.ndays.value<1){
alert("Please enter a number greater than 0.   ");
return false;
}


}




function validSendDate(){
if(document.scheduleform.message_dtdeploy_date.value == ""){
alert("Please select a date to deliver your message.\t");
return false;
}

}





function resendCampaign(campaignid){
alert(campaignid);

}


// PREVIEW CAMPAIGN FUNCTION

function previewCampaign(campaignid,messageid,type) {

/*var type;
for (var i=0; i<document.previewForm.preview_campaign.length; i++)  { 
 if (document.previewForm.preview_campaign[i].checked)  {
    type = document.previewForm.preview_campaign[i].value;
 } 
}
*/
url = 'act_campaign_preview_version.cfm?campaignid=' + campaignid + '&messageid=' + messageid + '&type=' + type;
NewWindow(url,'Preview','800','600','yes')
} 

function previewCampaignTemplate(campaignid,lu_templateid,type) {
//var type = html;
/*for (var i=0; i<document.previewForm.preview_campaign.length; i++)  { 
 if (document.previewForm.preview_campaign[i].checked)  {
    type = document.previewForm.preview_campaign[i].value;
 } 
}
*/
url = 'act_campaign_preview_version_template.cfm?campaignid=' + campaignid + '&lu_templateid=' + lu_templateid + '&type=' + type;
NewWindow(url,'Preview','800','600','yes')
//window.open(url,'Preview','width=800,height=600,resizable=1,scrollbars=1,statusbar=1');
} 


function previewTextVersion(messageid) {
url = 'act_campaign_preview_text_version.cfm?type=text&messageid=' + messageid;
window.open(url,'Preview','width=800,height=600,scrollbars=1');
}

function previewHTMLVersion(){
var html = document.forms[0].MESSAGE_HTMBODY.value;
url = 'act_campaign_preview_html_version.cfm?html=' + escape(html);
window.open(url,'Preview','width=800,height=600,scrollbars=1');
}


function previewTemplate(url) {
//window.open(url,'PreviewWindow','width=800,height=600,toolbar=0,scrollbars=1,resizable=1,statusbar=1');
NewWindow(url,'PreviewWindow','800','600','1');
}

// CREATE CAMPAIGN - USING A TEMPLATE 
function goTemplate(campaignid)
{
	box = document.camForm3.template;
	templateid = box.options[box.selectedIndex].value;

	if (templateid)  
	location.href = 'act_campaign_create_template.cfm?templateid=' + templateid + '&campaignid=' + campaignid;
	
}

function customizeComponent(templateid,component,type,cid) {
url = 'act_template_customize_component.cfm?lu_templateid=' + templateid + '&component=' + component + '&type=' + type + '&campaignid=' + cid;
//window.open(url,'CustomizeWindow','width=500,height=500,toolbar=0,scrollbars=1,statusbar=1,resizable=1');
NewWindow(url,'CustomizeWindow','700','500','1');
}

function validComponent() {
f = document.componentForm.elements[0];
if (f.value=="") {
alert("Please enter a value for this section.\t");
document.componentForm.elements[0].focus();
return false;
 }
 
  for(i=0; i< document.forms[0].elements.length; i++) {
	if(document.forms[0].elements[i].name == "component_value_url" && document.forms[0].elements[i].value == "http://") {
		alert("   Please enter a complete url.   \nExample: http://www.vissent.com   ");
		return false;
	}

  }

/*
	if (document.componentForm.component_value_url.value=="http://"){
	alert("   Please enter a complete url.   \nExample: http://www.vissent.com   ");
	document.componentForm.component_value_url.focus();
	return false; 
	} 


*/
}


function validFlashComponent() {
for (i=0; i<document.forms[0].elements.length; i++) {
   if (document.forms[0].elements[i].value == "") {
   alert("You are missing a required field.\t");
   return false;
   }
   else {  
   }
 }
}



function WinMediaComponent(){
var GoodChars = "0123456789";
var msg = "Please enter a valid number.   ";
f = document.forms[0];

if(f.component_wmedia_hi.value==""){
alert("Please enter the URL to the High Bandwidth version of this video.     ");
f.component_wmedia_hi.focus();
return false;
}

if(f.component_wmedia_low.value==""){
alert("Please enter the URL to the Low Bandwidth version of this video.     ");
f.component_wmedia_low.focus();
return false;
}

if(f.component_video_width.value==""){
alert("Please enter the display width in pixels for this movie.    ");
f.component_video_width.focus();
return false;
}

if(f.component_video_width.value!=""){
    	var ThisUnit = f.component_video_width.value;
	    vWidth = 1;
	
	for (i =0; i <= ThisUnit.length -1; i++) {
		if (GoodChars.indexOf(ThisUnit.charAt(i)) == -1) {
            alert(msg);
			f.component_video_width.focus();
			return false;
			vWidth = 0
		} // End if statement
	} // End for loop
	
	if(vWidth<1){ 
   		return false;
	 }
	 
}

if(f.component_video_height.value==""){
alert("Please enter the display height in pixels for this movie.    ");
f.component_video_height.focus();
return false;
}


if(f.component_video_height.value!=""){
    	var ThisUnit = f.component_video_height.value;
	    vHeight = 1;
	
	for (i =0; i <= ThisUnit.length -1; i++) {
		if (GoodChars.indexOf(ThisUnit.charAt(i)) == -1) {
            alert(msg);
			f.component_video_height.focus();
			return false;
			vHeight = 0
		} // End if statement
	} // End for loop
	
	if(vHeight<1){ 
   		return false;
	 }
}

if(f.component_background_image.value==""){
alert("Please select a background image.   ");
f.component_background_image.focus();
return false;
}


}








function componentSelectFlash(companyid){
url = 'act_template_flash_component.cfm?companyid=' + companyid;
window.open(url,'FlashWin','width=500,height=300,toolbar=0,scrollbars=1');
}

function selectThisMovie(movie,companyid) {
flashMovie = 'http://automation.vissent.com/company/' + companyid + '/flash/' + movie;
window.opener.document.forms[0].elements[0].value = flashMovie;
window.close();
}

function componentBackgroundImage(companyid){
url = 'act_template_bg_image_component.cfm?companyid=' + companyid;
window.open(url,'FlashBGWin','width=500,height=300,toolbar=0,scrollbars=1');
}

function componentImage(companyid){
url = 'act_template_image_component.cfm?companyid=' + companyid;
window.open(url,'ImageWin','width=500,height=400,toolbar=0,scrollbars=1,resizable=1');
}

function selectThisImage(image,companyid) {
ThisImage = 'http://automation.vissent.com/company/' + companyid + '/images/' + image;
window.opener.document.forms[0].component_background_image.value = ThisImage;
window.close();
}

function useThisImage(image,companyid) {
ThisImage = 'http://automation.vissent.com/company/' + companyid + '/images/' + image;
window.opener.document.forms[0].component_value_image.value = ThisImage;
window.close();
}

function chkTextVersion() {
if (document.forms[0].MESSAGE_TXTBODY.value == "") {
	alert("Please enter the text version of your message for this campaign.\t");
	document.forms[0].MESSAGE_TXTBODY.focus();
	return false;
    }
}




// Add a text link by popping up a window behind the current window
function addTextLink(campaignid) {
var page = 'act_campaign_add_text_link.cfm?campaignid=' + campaignid;
var windowprops = "width=600,height=400,location=no,menubar=no,toolbar=no,scrollbars=no,resizable=no";
linkWindow = window.open(page,'LinkWin',windowprops);
//linkWindow.blur();
}


// customize component functions 

function setupLink() 
{
if (document.forms[0].add_link.checked) {
  document.forms[0].component_value_url.value = 'http://';
  }
  else {
  document.forms[0].component_value_url.value = '';
  }
 
}


function doTextLink(action) { //start
    var revisedMessage;
    var currentMessage = document.forms[0].MESSAGE_TXTBODY.value;
	
if (action == "link") {
f = document.forms[0];
		//var theLink = prompt("Enter the address (URL) for the link you wish to insert.", "http://");
		if (f.link_url.value == "http://") {
		    alert('Please enter the URL to the web page for your link.\t'); 
			f.link_url.value="http://";
			f.link_url.focus();
			return false;}
		/*if (theLink == "http://") { 
			document.Message.Msg.focus();
			return false;}
		var theTitle = prompt("Enter a title for the link.", "");
		if (theTitle == "") { 
			document.Message.Msg.focus();
			return false;}*/
		//var vsxLink = "<a href='http://www.vissent.com/click.cfm?e=#e#&c=#c#&l=#l#&r="+f.link_url.value+"'>"+f.link_name.value+"</a>";
		var vsxLink = "http://click.vissent.com/click.cfm?e=#e#&c=#c#&l=#l#&r=" + f.link_url.value;
		revisedMessage = currentMessage+vsxLink;
		f.MESSAGE_TXTBODY.value=revisedMessage;
		f.MESSAGE_TXTBODY.focus();
		//f.link_name.value="";
		f.link_url.value="";
		return;}



}//end



function doHtmLink(action) { //start
    var revisedMessage;
    var currentMessage = document.forms[0].component_value.value;
	
if (action == "link") {
f = document.forms[0];
		//var theLink = prompt("Enter the address (URL) for the link you wish to insert.", "http://");
		if (f.link_name.value == "") {
		    alert('Please enter the text to be displayed for this link.\t'); 
			f.link_name.value="";
			f.link_name.focus();
			return false;}
		if (f.link_url.value == "") {
		    alert('Please enter the URL to the web page for your link.\t'); 
			f.link_url.value="http://";
			f.link_url.focus();
			return false;}
		/*if (theLink == "http://") { 
			document.Message.Msg.focus();
			return false;}
		var theTitle = prompt("Enter a title for the link.", "");
		if (theTitle == "") { 
			document.Message.Msg.focus();
			return false;}*/
		var vsxLink = "<a href='http://click.vissent.com/click.cfm?e=#e#&c=#c#&l=#l#&r="+f.link_url.value+"'>"+f.link_name.value+"</a>";
		revisedMessage = currentMessage+vsxLink;
		f.component_value.value=revisedMessage;
		f.component_value.focus();
		f.link_name.value="";
		f.link_url.value="";
		return;}



}//end


// ******************* BEGIN WYSIWYG FUNCTIONS ************************* //

/* 	Add a hyperlink - mode is MESSAGE_HTMBODY or MESSAGE_TXTBODY */
function addHyperLink(mode) {
if (mode == "text") {

}

if (mode == "html") {
url = "./wysiwyg/hyperlink.cfm";
window.open(url,'HyperlinkWin','width=500,height=350,toolbar=0,scrollbars=1,statusbar=1,resizable=1');
}

}

/* 	Insert Image from Digital Assets  */
function insertImage(companyid) {
url = "./wysiwyg/image.cfm?companyid=" + companyid;
window.open(url,'ImageWin','width=700,height=400,toolbar=0,scrollbars=1,resizable=1,statusbar=1');
}

/* 	Insert Flash Movie from Digital Assets  */
function insertFlash(companyid) {
url = "./wysiwyg/flash.cfm?companyid=" + companyid;
window.open(url,'FlashWin','width=700,height=400,toolbar=0,scrollbars=1,resizable=1,statusbar=1');
}

/* 	Insert Table  */
function insertTable() {
}

/* 	Insert Line Break <br>  */
function insertLineBreak() {
}

/* 	Set Font Attribures Color, Size, Type  */
function setFontStyle() {
}

/* 	Set Bold Font  */
function boldFont() {
}

/* 	Set Italic Font  */
function italicFont() {
}

/* 	Set Underline Font  */
function underlineFont() {
}

/* 	Set Alignment  */
function setAlignment(mode) {
}

// ******************* END OF WYSIWYG FUNCTIONS ************************ //


// ******************** DIGITAL ASSET FUNCTIONS **************************** // 

function dl_validForm(){
if (document.forms[0].elements[0].value=="") {
 alert('Please select a file to upload.\t');
 return false;
 }
}

function validateImage() {
var ext;
upload=document.MyImageForm.my_image.value;
ext=upload.substr(upload.lastIndexOf(".")).toLowerCase();

if (ext!=".jpeg"&&ext!=".jpg"&&ext!=".pgif"&&ext!=".gif") {
   alert("Please select a GIF or JPG file to upload.\t");
   return false;
 }
} 

function validateFlash() {
var ext;
upload=document.MyFlashForm.flash_movie.value;
ext=upload.substr(upload.lastIndexOf(".")).toLowerCase();

if (ext!=".swf") {
   alert("Please select a flash (.swf) file to upload.\t");
   return false;
 }
}

function dl_DeleteFlash(filename) {
result = window.confirm('Are you sure you want to delete this movie?\t');

if (result){
 window.location='./cgi/qry_library_delete_flash.cfm?f=' + filename;
  }
}

function dl_DeleteImage(filename) {
result = window.confirm('Are you sure you want to delete this image?\t');

if (result){
 window.location='./cgi/qry_library_delete_image.cfm?f=' + filename;
  }
}


function resizeImage(obj){
url='act_resize_image.cfm?f=' + escape(obj);
NewWindow(url,'ResizeWin','600','300','yes')
}

function goResize(){
f = document.resizeForm;
var GoodChars = "0123456789";
var msg = "Please enter a valid number.   ";

if(f.fn.value==""){
alert("There was a problem selecting your file. Please try again.     ");
window.close();
return false;
}


if(f.new_width.value==""){
alert("Please enter a numeric value for width.     ");
return false;
}

//
if(f.new_width.value!=""){
    	var ThisUnit = f.new_width.value;
	    valid = 1;
	
	for (i =0; i <= ThisUnit.length -1; i++) {
		if (GoodChars.indexOf(ThisUnit.charAt(i)) == -1) {
            alert(msg);
			f.new_width.focus();
			return false;
			valid = 0
		} // End if statement
	} // End for loop
	
	if(valid<1){ 
   		return false;
	 }
	}
	
if (f.new_width.value<1){
 alert("Please enter a value greater than 0.    ");
 f.new_width.focus();
 return false;
}
//




if(f.new_height.value==""){
alert("Please enter a numeric value for height.     ");
return false;
}

if(f.new_height.value!=""){
    	var ThisHeight = f.new_height.value;
	    valid = 1;
	
	for (i =0; i <= ThisHeight.length -1; i++) {
		if (GoodChars.indexOf(ThisHeight.charAt(i)) == -1) {
            alert(msg);
			f.new_height.focus();
			return false;
			valid = 0
		} // End if statement
	} // End for loop
	
	if(valid<1){ 
   		return false;
	 }
	}
	
if (f.new_height.value<1){
 alert("Please enter a value greater than 0.    ");
 f.new_height.focus();
 return false;
}
}//end


function resizeComplete(){
window.opener.location.href='act_image_library.cfm';
window.close();
}


// ******************** END DIGITAL ASSET FUNCTIONS ************************ // 

// ******************** START REPORT FUNCTIONS ************************ // 

function sendToArchive(){
var chkbox = document.forms[0].campaignid;
var n = false;

for(i=0;i<chkbox.length;i++){  
   if(chkbox[i].checked==true){
   n=true;
   } 
 }

if(!n){
 alert("Please select one or more campaigns to archive.\t");
 return false;
}
	
}


function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}
// ******************** END REPORT FUNCTIONS ************************ // 

// ********************* POLL FUNCTIONS ***************************** //

function createPoll(){
f = document.forms[0];

if(f.poll_name.value==""){
alert("Please enter a name for your new poll.    ");
f.poll_name.focus();
return false;
}

if(f.poll_expire.value==""){
alert("Please select a date when this poll will expire.   ");
f.poll_expire.focus();
return false;
}

if(f.poll_question.value==""){
alert("Please enter a question you would like to use to poll your subscribers.");
f.poll_question.focus();
return false;
}


}



function copyCampaign(id){
url="./cgi/qry_copy_campaign.cfm?c=" + id;
window.location.href=url;
}


