﻿// JavaScript Documentfunction flashingText(div, class1, class2){	if(document.getElementById(div).className == class1)	{		document.getElementById(div).className=class2;	}	else	{		document.getElementById(div).className=class1;	}}// http://www.onlinebuttonsecrets.com// Preload Over and Down state imagesImage1= new Image(10,12);Image1.src = "http://www.onlinebuttonsecrets.com/covers/abv3Down.gif";Image2= new Image(10,12);Image2.src = "http://www.onlinebuttonsecrets.com/covers/abv3Over.gif";Image3= new Image(10,12);Image3.src = "http://www.onlinebuttonsecrets.com/covers/abv3Up.gif";function alexButton(state, ID){	switch(state)	{		case "press":			document.getElementById(ID).style.backgroundImage='url(http://www.onlinebuttonsecrets.com/covers/abv3Down.gif)';			document.getElementById(ID).style.backgroundPosition='top';			break;		case "over":			document.getElementById(ID).style.backgroundPosition='top';			document.getElementById(ID).style.backgroundImage='url(http://www.onlinebuttonsecrets.com/covers/abv3Over.gif)';			break;		case "up":		default:		// Up				document.getElementById(ID).style.backgroundPosition='bottom';			document.getElementById(ID).style.backgroundImage='url(http://www.onlinebuttonsecrets.com/covers/abv3Up.gif)';			break;	}}function linkify(URL,target, config){	if(target != '')	{		// Open in a new window		window.open(URL, target, config);	}	else	{		location.href=URL;	}}function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_validateForm() { //v4.0  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);    if (val) { nm=val.id; if ((val=val.value)!="") {      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';      } else if (test!='R') { num = parseFloat(val);        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');          min=test.substring(8,p); max=test.substring(p+1);          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }  } if (errors) alert('The following error(s) occurred:\n'+errors);  document.MM_returnValue = (errors == '');}function doSubmit(first_name, page){	switch(page)	{		case 'index':			// Ask Page			MM_validateForm('custom_comment','','R','first_name','','R','email','','RisEmail'); 			break;		case 'taf':			// Tell-A-Friend			MM_validateForm('Your First Name','','R','Your Email','','RisEmail','Friends Name','','R','Friends Email','','RisEmail');			break;	}		if(document.MM_returnValue != true)	{		return document.MM_returnValue;	}	else	{		switch(page)		{			case 'index':				// Ask Page				document.forms[first_name].submit();				break;			case 'taf':				// Tell-A-Friend				document.forms[first_name].elements['ajax'].value = 'true';				submitForm(document.forms[first_name]);				break;		}	}}/* Collapsable/Expandable Div Display Box */function showDiv(ID){	// If there is no div, don't throw a JavaScript error	if(!document.getElementById(ID)){ return false; }		// Evaluate the current visibility status of the display box.	if(document.getElementById(ID).style.display == 'none')	{		// The display box is not visible, so we want to display the box		document.getElementById(ID).style.display='block';	}	else	{		// The display box is visible, so we want to hide the display box		document.getElementById(ID).style.display='none';	}}function up_or_down(ID){	if(up == true)	{		document.getElementById(ID).src = 'images/Collapse-Up.jpg';		up = false;	}	else	{				document.getElementById(ID).src = 'images/Collapse-Down.jpg';			up = true;	}}function hideMessage(){	// Hide system messages on Admin page.	document.getElementById('message').style.display='none';	clearInterval(intervalID);}function addSecurityCode(first_name, fieldName, ID){	securityCode = document.forms[first_name].elements[fieldName];	// Does the field have data in it?	if(securityCode.value.length != 0)	{		secruityLock = "?vbt=" + securityCode.value;	}	else	{		secruityLock = '';	}		// Return data to page	document.getElementById(ID).innerHTML= secruityLock;}function forceDownloadAlert(){	if(document.forms['form1'].elements['forceDownload'].checked == true)	{		alert('By checking this box you will have to upload the config.ask.php file manually.');	}}function setImage(newValue, img, first_name, fieldName){	if(newValue != '')	{ 		document.getElementById(img).src= newValue; 		document.forms[first_name].elements[fieldName].value= newValue; 	}}function setFile(newValue, first_name, fieldName){	if(newValue != '')	{ 		document.forms[first_name].elements[fieldName].value= newValue; 	}}function submitForm(f){	if(window.XMLHttpRequest){	var xmlReq = new XMLHttpRequest();	} else if(window.ActiveXObject) {	var xmlReq = new ActiveXObject('Microsoft.XMLHTTP');	}	var formData = '', elem = '';	for(var s=0; s<f.elements.length; s++){	elem = f.elements[s];	if(formData != ''){	formData += '&';	}	formData += elem.name+"="+elem.value;	}	xmlReq.onreadystatechange = function(){	if(xmlReq.readyState == 4){	document.getElementById('taf').innerHTML = xmlReq.responseText;	}	}	xmlReq.open(f.method, f.action, true);	xmlReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	xmlReq.send(formData);	return false;}function setFlashCode(first_name, targetFieldName, filePath, swfWidth, swfHeight){	// Look for existing content	if(document.forms[first_name].elements[targetFieldName].value != '')	{		overwrite = confirm("This Custom HTML field already contains data.\nAre you sure you want to overwrite the current data?\n\nIf you would like to overwrite the current data press `Ok`\n\nOR\n\nIf you want to keep the current data press `Cancel`.");	}	else{ overwrite = true; }		if(overwrite == true)	{		output  = '<script type="text/javascript">\n';				output += "AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0','width','"+ swfWidth +"','height','"+ swfHeight +"','src','" + filePath.substr(0, (filePath.length-4)) + "','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','" + filePath.substr(0, (filePath.length-4)) + "' ); //end AC code";		output += '</script>\n';		output += '<noscript>\n';		output += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" height="' + swfHeight + '" width="' + swfWidth + '">\n';		output += '<param name="movie" value="' + filePath + '">\n';		output += '<param name="quality" value="high">\n';		output += '<embed src="' + filePath + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" height="' + swfHeight + '" width="' + swfWidth + '">';		output += '</object>\n';		output += '</noscript>';			// Set new HTML		document.forms[first_name].elements[targetFieldName].value=output;	}}function setImageCode(first_name, targetFieldName, filePath, imgWidth, imgHeight, imgBorder, imgTitle, imgAlign){	// Look for existing content	if(document.forms[first_name].elements[targetFieldName].value != '')	{		overwrite = confirm("This Custom HTML field already contains data.\nAre you sure you want to overwrite the current data?\n\nIf you would like to overwrite the current data press `Ok`\n\nOR\n\nIf you want to keep the current data press `Cancel`.");	}	else{ overwrite = true; }		if(overwrite == true)	{		// check for empty attributes and do not include them		if(imgWidth == '')  { newWidth = "";   } else { newWidth   = ' width="' + imgWidth + '"'; }		if(imgHeight == '') { newHeight = "";  } else { newHeight = ' height="' + imgHeight + '"'; }		if(imgTitle == '')  { newTitle = "";   } else { newTitle   = ' title="' + imgTitle + '"'; }		if(imgBorder == '') { newBorder = "";  } else { newBorder  = ' border="' + imgBorder + '"'; }		if(imgAlign == '')  { newAlign = "";   } else { newAlign   = ' align="' + imgAlign + '"'; }						output = '<img src="' + filePath + '"' + newHeight + newWidth + newTitle + newBorder + newAlign + '>';		// Set new HTML		document.forms[first_name].elements[targetFieldName].value=output;				}}function setInputValue(first_name, fieldName, newValue){	document.forms[first_name].elements[fieldName].value= newValue;}function campaign(type){	field     = new Array();	field[0]  = "_common['teleseminar_call_duration']";	field[1]  = "_common['teleseminar_date']";	field[2]  = "_common['teleseminar_time']";	field[3]  = "_common['teleseminar_phone_number']";	field[4]  = "_common['teleseminar_pass_code']";	field[5]  = "scrapbookEight";	field[6]  = "_thanks['notes']";	field[7]  = "_thanks['is_paid']";	field[8]  = "_thanks['pay_url']";	field[9]  = "_replay['is_paid']";	field[10] = "_replay['pay_url']";	field[11] = "scrapbookFive";	field[12] = "_replay['image']";	field[13] = "scrapbookSix";	field[14] = "_replay['transcript']";	field[15] = "_replay['one_click']";	field[16] = "_replay_audio[1]";	field[17] = "_replay_audio[2]";	field[18] = "_replay_audio[3]";	field[19] = "_replay_audio[4]";	field[20] = "_replay_audio[5]";	field[21] = "_replay_audio[6]";	field[22] = "_replay_download[1]";	field[23] = "_replay_download[2]";	field[24] = "_replay_download[3]";	field[25] = "_replay_download[4]";	field[26] = "_replay_download[5]";	field[27] = "_replay_download[6]";	field[28] = "_replay['taf_subject']";	field[29] = "_replay['taf_email']";		for(i=0; i<=(field.length-1); i++)	{		if(type == 'ask'){ document.forms['form1'].elements[field[i]].disabled = true; document.getElementById('rcYes').disabled = true; document.getElementById('rcNo').disabled = true; }		else             { document.forms['form1'].elements[field[i]].disabled = false; document.getElementById('rcYes').disabled = false; document.getElementById('rcNo').disabled = false; }	}		if(type == 'ask'){ document.getElementById('disableReplay').style.display = "none"; document.getElementById('replayAlert').style.display = "block"; }	else             { document.getElementById('disableReplay').style.display = "block"; document.getElementById('replayAlert').style.display = "none"; }}
