function consultantAlert() {
	window.alert("This video is not available for purchase for your industry.\nPlease contact us at 1-800-408-5657 for further assistance.");
}
function chatWin() {
	window.open("http://messenger.providesupport.com/messenger/mpcfilms.html", "_blank", "menubar=0,location=0,scrollbars=auto,resizable=1,status=0,width=650,height=460");
}
var LoadingDialog;
var CIDDialog;
var HelpDialog;
var JoinDialog;
var JoinTYDialog;
var JoinEmailOk = "n";
var LoginDialog;
var LoginTYDialog;
var LoginErrDialog;
var ForgotDialog;
var ForgotTYDialog;
var ForgotErrorDialog;
var IndustryUpdateDialog;
var IndustryUpdateTYDialog;
var JoinDialogReady = 0;
var CIDDialogReady = 0;
var HelpDialogReady = 0;
var LoginDialogReady = 0;
var ForgotDialogReady = 0;
function emailCheck(e) {
	var etrim = e.replace(/^\s+|\s+$/g, '');
	if ((etrim.indexOf('@') == -1) || (etrim.indexOf('.') == -1)) {
		JoinEmailOk = "n";
	}
	else {
		var sUrl = "http://www.customerservicehero.com/join_email_check.php?e=" + etrim;
		var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, 	{
			success : function(o) {
				var response = o.responseText;
				if (response == 1) {
					JoinEmailOk = "n";
				}
				else {
					JoinEmailOk = "y";
				}
			},
			failure : function(o) {
				alert("DB error");
			},
			argument: { foo:"foo", bar:"bar" }
		});
	}
}
var handleSubmit = function() {this.submit();};
var handleLoginError = function() {
	this.cancel();
	LoginDialog.show();
};
var handleForgot = function() {
	this.cancel();
	showForgot();
};
var handleLoginSuccess = function(o) {
	var response = o.responseText;
	if (response == "1") {
		LoginTYDialog.show();
	}
	else if (response == "2") {
		showIndustryUpdate();
	}
	else {
		LoginErrorDialog.show();
	}
};
var handleLoginFailure = function(o) {alert("Login failed: " + o.status);};
var handleYes = function() {
	this.hide();
	window.location.reload(true);
};
var handleCancel = function() {this.cancel();};
var handleForgotSuccess = function(o) {
	var response = o.responseText;
	if (response == "1") {
		ForgotTYDialog.show();
	}
	else {
		ForgotErrorDialog.show();
	}
};
var handleForgotFailure = function(o) {alert("Lookup failed: " + o.status);};
var handleIndustryUpdateSuccess = function(o) {
	var response = o.responseText;
	if (response == "1") {
		IndustryUpdateTYDialog.show();
	}
};
var handleIndustryUpdateFailure = function(o) {alert("Error during update: " + o.status);};
var handleJoinSuccess = function(o) {
	var response = o.responseText;
	if (response == "1") {
		JoinTYDialog.show();
	}
	else {
		alert("There was an error.  Please try joining again.");
	}
};
var handleJoinFailure = function(o) {alert("Submission failed: " + o.status);};
var handleHelpSuccess = function(o) {
	var response = o.responseText;
	if (response == "1") {
		HelpTYDialog.show();
	}
	else {
		alert("There was an error.  Please try again.");
	}
};
var handleHelpFailure = function(o) {alert("Submission failed: " + o.status);};
YAHOO.util.Event.onDOMReady(function () {
	LoadingDialog =  new YAHOO.widget.Panel("LoadingDialog", {width:"300px", fixedcenter:true, close:false, draggable:false, modal:true, visible:false});
	LoadingDialog.setHeader("<div class=\"tl\"></div><span>Loading, please wait...</span><div class=\"tr\"></div>");
	LoadingDialog.setBody("<div style=\"text-align:center;\"><img src=\"/images/loading.gif\" /></div>");
	LoadingDialog.render("main");
	LoginTYDialog = new YAHOO.widget.SimpleDialog("LoginTYDialog",  {width:"300px", fixedcenter:true, close:false, visible:false, modal:true, text:"Thank you for logging in!", constraintoviewport:true, buttons:[{text:"Continue", handler:handleYes, isDefault:true}]}); 
	LoginTYDialog.setHeader("<div class=\"tl\"></div><span>Welcome Back!</span><div class=\"tr\"></div>");
	LoginTYDialog.render("main");
	LoginErrorDialog = new YAHOO.widget.SimpleDialog("LoginErrorDialog",  {width:"300px", fixedcenter:true, visible:false, modal:true, text:"Please try logging in again or click on Forgot Your Password.", constraintoviewport:true, buttons:[{text:"Try Again", handler:handleLoginError, isDefault:true}, {text:"Forgot Your Password", handler:handleForgot}]}); 
	LoginErrorDialog.setHeader("<div class=\"tl\"></div><span>Login - Error</span><div class=\"tr\"></div>");
	LoginErrorDialog.render("main");
	ForgotTYDialog = new YAHOO.widget.SimpleDialog("ForgotTYDialog",  {width:"300px", fixedcenter:true, visible:false, modal:true, text:"Your login information has been sent via email.", constraintoviewport:true, buttons:[{text:"Close", handler:handleCancel, isDefault:true}]}); 
	ForgotTYDialog.setHeader("<div class=\"tl\"></div><span>Forgot Your Password</span><div class=\"tr\"></div>");
	ForgotTYDialog.render("main");
	ForgotErrorDialog = new YAHOO.widget.SimpleDialog("ForgotErrorDialog",  {width:"300px", fixedcenter:true, visible:false, modal:true, text:"Email address does not match our records. Please try again.", constraintoviewport:true, buttons:[{text:"Try Again", handler:handleForgot, isDefault:true}]}); 
	ForgotErrorDialog.setHeader("<div class=\"tl\"></div><span>Forgot Your Password - Error</span><div class=\"tr\"></div>");
	ForgotErrorDialog.render("main");
	IndustryUpdateTYDialog = new YAHOO.widget.SimpleDialog("IndustryUpdateTYDialog",  {width:"300px", fixedcenter:true, visible:false, modal:true, text:"Thank you for updating your industry!", constraintoviewport:true, buttons:[{text:"Close", handler:handleYes, isDefault:true}]}); 
	IndustryUpdateTYDialog.setHeader("<div class=\"tl\"></div><span>Industry Update</span><div class=\"tr\"></div>");
	IndustryUpdateTYDialog.render("main");
	JoinTYDialog = new YAHOO.widget.SimpleDialog("JoinTYDialog",  {width:"300px", fixedcenter:true, close:false, visible:false, modal:true, text:"Now you can enjoy all the benefits of a member!", constraintoviewport:true, buttons:[{text:"Continue", handler:handleYes, isDefault:true}]}); 
	JoinTYDialog.setHeader("<div class=\"tl\"></div><span>Thank you for joining!!!</span><div class=\"tr\"></div>");
	JoinTYDialog.render("main");
	HelpTYDialog = new YAHOO.widget.SimpleDialog("HelpTYDialog",  {width:"300px", fixedcenter:true, close:false, visible:false, modal:true, text:"Thanks for letting us know. We're working on the problem right now. If you have any questions or would like to receive a FREE DVD or VHS preview, please let us know! 1-800-408-5657", constraintoviewport:true, buttons:[{text:"Close", handler:handleCancel, isDefault:true}]}); 
	HelpTYDialog.setHeader("<div class=\"tl\"></div><span>Thank You!</span><div class=\"tr\"></div>");
	HelpTYDialog.render("main");
	
	
	ItemListDefault = new YAHOO.widget.Module("ItemListDefault", { visible: true}); 
	ItemListDefault.render();
	ItemListAnimOn = new YAHOO.util.Anim("ItemListDefault", {opacity: {to: 1}}, .5, YAHOO.util.Easing.easeIn);
	ItemListAnimOff = new YAHOO.util.Anim("ItemListDefault", {opacity: {to: 0}}, .5, YAHOO.util.Easing.easeIn);
	ItemListDefault.show();
});
function showLogin() {
	LoadingDialog.show();
	if (LoginDialogReady == 0) {
		var conn = YAHOO.util.Connect.asyncRequest('GET', "http://www.customerservicehero.com/login_dialog.php", {
			success : function(o) {
				LoginDialog = new YAHOO.widget.Dialog("LoginDialog",  {width:"300px", fixedcenter:true, visible:false, modal:true, constraintoviewport:true, buttons:[{text:"Login", handler:handleSubmit, isDefault:true}, {text:"Forgot Your Password", handler:handleForgot}]}); 
				LoginDialog.setHeader("<div class=\"tl\"></div><span>Login Now!</span><div class=\"tr\"></div>");
				LoginDialog.setBody(o.responseText);
				LoginDialog.validate = function() {
					var data = this.getData();
					if (data.email == "") {
						alert("Please enter your email address.");
						return false;
					}
					else if (data.password == "") {
						alert("Please enter your password.");
						return false;
					}
					else {
						return true;
					}
				};
				LoginDialog.callback = {success:handleLoginSuccess, failure:handleLoginFailure};
				LoginDialog.render("main");
				LoadingDialog.hide();
				LoginDialog.show();
				LoginDialogReady = 1;
			},
			failure : function(o) {
				LoadingDialog.hide();
				alert("Connection Error.  Try again.");
			}
		});
	}
	else {
		LoadingDialog.hide();
		LoginDialog.show();
	}
}
function showForgot() {
	LoadingDialog.show();
	if (ForgotDialogReady == 0) {
		var conn = YAHOO.util.Connect.asyncRequest('GET', "http://www.customerservicehero.com/forgot_dialog.php", {
			success : function(o) {
				ForgotDialog = new YAHOO.widget.Dialog("ForgotDialog",  {width:"300px", fixedcenter:true, visible:false, modal:true, constraintoviewport:true, buttons:[{text:"Submit", handler:handleSubmit, isDefault:true}, {text:"Cancel", handler:handleCancel}]}); 
				ForgotDialog.setHeader("<div class=\"tl\"></div><span>Forgot Your Password</span><div class=\"tr\"></div>");
				ForgotDialog.setBody(o.responseText);
				ForgotDialog.validate = function() {
					var data = this.getData();
					if (data.email == "") {
						alert("Please enter your email address.");
						return false;
					}
					else {
						return true;
					}
				};
				ForgotDialog.callback = {success:handleForgotSuccess, failure:handleForgotFailure};
				ForgotDialog.render("main");
				LoadingDialog.hide();
				ForgotDialog.show();
				ForgotDialogReady = 1;
			},
			failure : function(o) {
				LoadingDialog.hide();
				alert("Connection Error.  Try again.");
			}
		});
	}
	else {
		LoadingDialog.hide();
		ForgotDialog.show();
	}
}
function showJoin() {
	var vph = 1000;
	vph = YAHOO.util.Dom.getViewportHeight();
	if (vph < 600) {
		window.location = "http://www.customerservicehero.com/join/";
	}
	else {
		LoadingDialog.show();
		if (JoinDialogReady == 0) {
			var conn = YAHOO.util.Connect.asyncRequest('GET', "http://www.customerservicehero.com/join_dialog.php", {
				success : function(o) {
					JoinDialog = new YAHOO.widget.Dialog("JoinDialog",  {width:"529px", fixedcenter:true, visible:false, modal:true, constraintoviewport:true, buttons:[{text:"Submit", handler:handleSubmit, isDefault:true}, {text:"Cancel", handler:handleCancel}]});
					JoinDialog.setHeader('<div class=\"tl\"></div><span>Join Media Partners Today!  (It\'s free!)</span><div class=\"tr\"></div>');
					JoinDialog.setBody(o.responseText);
					JoinDialog.validate = function() {
						var data = this.getData();
						if (JoinEmailOk == "n") {
							emailCheck(data.email);
							jswait(2000);
						}
						if (data.fname == "" || data.lname == "") {
							alert("Please enter your first and last names.");
							return false;
						}
						else if (data.title == "") {
							alert("Please enter your Title.");
							return false;
						}
						else if (data.org == "") {
							alert("Please enter your Company Name.");
							return false;
						}
						else if (data.industry == "Choose") {
							alert("Please choose an option from \"Industry\".");
							return false;
						}
						else if (vqrc == "") {
							alert("Please answer Yes or No to the Industry Verification Question.");
							return false;
						}
						else if (data.email == "") {
							alert("Please enter your email address.");
							return false;
						}
						else if ((data.email.indexOf('@') == -1) || (data.email.indexOf('.') == -1)) {
						  alert("Your e-mail address is not formatted correctly. Check it and try again.");
						  return false;
						}
						else if (data.email != data.confirm_email) {
							alert("Your e-mail addresses do not match. Please fix.");
							return false;
						}
									else if (data.password == "") {
							alert("Please enter your password.");
							return false;
						}
						else if (data.password != data.password2) {
							alert("Please passwords do not match. Please fix.");
							return false;
						}
						else if (JoinEmailOk == "n") {
							alert("The email you entered exists in our database.  Either use another email address or try logging in.");
							return false;
						}
						else {
							return true;
						}
					};
					JoinDialog.callback = {success:handleJoinSuccess, failure:handleJoinFailure};
					JoinDialog.render("main");
					LoadingDialog.hide();
					JoinDialog.show();
					JoinDialogReady = 1;
				},
				failure : function(o) {
					LoadingDialog.hide();
					alert("Connection Error.  Try again.");
				}
			});
		}
		else {
			LoadingDialog.hide();
			JoinDialog.show();
		}
	}
}
function showIndustryUpdate() {
	LoadingDialog.show();
	var conn = YAHOO.util.Connect.asyncRequest('GET', "http://www.customerservicehero.com/industry_update_dialog.php", {
		success : function(o) {
			IndustryUpdateDialog = new YAHOO.widget.Dialog("IndustryUpdateDialog",  {width:"500px", fixedcenter:true, visible:false, modal:true, close:false, constraintoviewport:true, buttons:[{text:"Submit", handler:handleSubmit, isDefault:true}]}); 
			IndustryUpdateDialog.setHeader("<div class=\"tl\"></div><span>Industry Update</span><div class=\"tr\"></div>");
			IndustryUpdateDialog.setBody(o.responseText);
			IndustryUpdateDialog.validate = function() {
				var data = this.getData();
				if (data.industry == "Choose") {
					alert("Please select an industry from the list.");
					return false;
				}
				else if (vqrc == "") {
					alert("Please answer Yes or No.");
					return false;
				}
				else {
					return true;
				}
			};
			IndustryUpdateDialog.callback = {success:handleIndustryUpdateSuccess, failure:handleIndustryUpdateFailure};
			IndustryUpdateDialog.render("main");
			LoadingDialog.hide();
			IndustryUpdateDialog.show();
			IndustryUpdateDialogReady = 1;
		},
		failure : function(o) {
			LoadingDialog.hide();
			alert("Connection Error.  Try again.");
		}
	});
}
function showHelp() {
	LoadingDialog.show();
	if (HelpDialogReady == 0) {
		var conn = YAHOO.util.Connect.asyncRequest('GET', "http://www.customerservicehero.com/help_dialog.php?FlashVer="+prosupfv+"&Page="+escape(location.href), {
			success : function(o) {
				HelpDialog = new YAHOO.widget.Dialog("HelpDialog",  {width:"500px", fixedcenter:true, visible:false, modal:true, constraintoviewport:true, buttons:[{text:"Submit", handler:handleSubmit, isDefault:true}, {text:"Cancel", handler:handleCancel}]});
				HelpDialog.setHeader('<div class=\"tl\"></div><span>Having trouble watching videos?</span><div class=\"tr\"></div>');
				HelpDialog.setBody(o.responseText);
				HelpDialog.validate = function() {
					var data = this.getData();
					if (data.name == "") {
						alert("Please enter your name.");
						return false;
					}
					else if (data.email == "") {
						alert("Please enter your email address.");
						return false;
					}
					else if ((data.email.indexOf('@') == -1) || (data.email.indexOf('.') == -1)) {
					  alert("Your e-mail address is not formatted correctly. Check it and try again.");
					  return false;
					}
					else if (data.comments.length == 0) {
						alert("Please explain the problem you are experiencing.");
						return false;
					}
					else {
						return true;
					}
				};
				HelpDialog.callback = {success:handleHelpSuccess, failure:handleHelpFailure};
				HelpDialog.render("main");
				LoadingDialog.hide();
				HelpDialog.show();
				HelpDialogReady = 1;
			},
			failure : function(o) {
				LoadingDialog.hide();
				alert("Connection Error.  Try again.");
			}
		});
	}
	else {
		LoadingDialog.hide();
		HelpDialog.show();
	}
}
function showCID() {
	LoadingDialog.show();
	if (CIDDialogReady == 0) {
		var conn = YAHOO.util.Connect.asyncRequest('GET', "https://www.customerservicehero.com/cid.popup.htm", {
			success : function(o) {
				CIDDialog = new YAHOO.widget.Dialog("CIDDialog",  {width:"500px", fixedcenter:true, visible:false, modal:true, constraintoviewport:true, buttons:[{text:"Close", handler:handleCancel, isDefault:true}]});
				CIDDialog.setHeader('<div class=\"tl\"></div><span>What is a Credit Card Identification Code?</span><div class=\"tr\"></div>');
				CIDDialog.setBody(o.responseText);
				CIDDialog.render("main");
				LoadingDialog.hide();
				CIDDialog.show();
				CIDDialogReady = 1;
			},
			failure : function(o) {
				CIDDialog.hide();
				alert("Connection Error.  Try again.");
			}
		});
	}
	else {
		LoadingDialog.hide();
		CIDDialog.show();
	}
}
function JoinValidate() {
	var FormPath;
	FormPath = document.joinprocess;
	if (JoinEmailOk == "n") {
		if (FormPath.email.value == "") {
			//do nothing	
		}
		else {
			emailCheck(FormPath.email.value);
			jswait(2000);
		}
	}
	if (FormPath.fname.value == "" || FormPath.lname.value == "") {
		alert("Please enter your first and last names.");
		return false;
	}
	else if (FormPath.title.value == "") {
		alert("Please enter your Title.");
		return false;
	}
	else if (FormPath.org.value == "") {
		alert("Please enter your Company Name.");
		return false;
	}
	else if (FormPath.industry.value == "Choose") {
		alert("Please choose an option from \"Industry\".");
		return false;
	}
	else if (vqrc == "") {
		alert("Please answer Yes or No to the Industry Verification Question.");
		return false;
	}
	else if (FormPath.email.value == "") {
		alert("Please enter your email address.");
		return false;
	}
	else if ((FormPath.email.value.indexOf('@') == -1) || (FormPath.email.value.indexOf('.') == -1)) {
	  alert("Your e-mail address is not formatted correctly. Check it and try again.");
	  return false;
	}
	else if (FormPath.email.value != FormPath.confirm_email.value) {
		alert("Your e-mail addresses do not match. Please fix.");
		return false;
	}
	else if (FormPath.password.value == "") {
		alert("Please enter your password.");
		return false;
	}
	else if (FormPath.password.value != FormPath.password2.value) {
		alert("Please passwords do not match. Please fix.");
		return false;
	}
	else if (JoinEmailOk == "n") {
		alert("The email you entered exists in our database.  Either use another email address or try logging in.");
		return false;
	}
	else {
		FormPath.submit();
	}
}
function gotoLogin() {
	JoinDialog.hide();
	showLogin();
}
var swffv = deconcept.SWFObjectUtil.getPlayerVersion();
var prosupfv = swffv['major'];
if (prosupfv == 0) {prosupfv = "Flash not installed";}
function ReviewSubmit() {
	var FormPath;
	FormPath = document.speaker_review;
	if (FormPath.name.value == "") {
		alert("Please enter your name.");
	}
	else if (FormPath.location.value == "") {
		alert("Please enter your City, State.");
	}
	else if (FormPath.review.value == "") {
		alert("Please enter your Review.");
	}
	else {
		FormPath.submit();
	}
}
function ContactUsSubmit() {
	var FormPath;
	FormPath = document.contact_us;
	if (FormPath.fname.value == "") {
		alert("Please enter your First Name.");
		return false;
	}
	else if (FormPath.lname.value == "") {
		alert("Please enter your Last Name.");
		return false;
	}
	else if (FormPath.email.value == "") {
		alert("Please enter your email address.");
		return false;
	}
	else if ((FormPath.email.value.indexOf('@') == -1) || (FormPath.email.value.indexOf('.') == -1)) {
	  alert("Your e-mail address is not formatted correctly. Check it and try again.");
	  return false;
	}
	else if (FormPath.msg.value == "") {
		alert("Please enter your Message.");
		return false;
	}
	else {
		FormPath.submit();
	}
}
function toggleItemList(tn, n) {
	if (n != 'null') {
		var tmpf = "changeItemList('"+tn+"', '"+n+"')";
		ItemListAnimOff.animate();
		ItemListTimer = setTimeout(tmpf, 500);
	}
}
function changeItemList(tn, n) {
	var sUrl = "http://www.customerservicehero.com/"+tn+"list.php?&tn=" + tn + "&sort=" + n;
	targetDiv = document.getElementById("ItemListDefault");
	var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, 	{
		success : function(o) {
			if(o.responseText !== undefined) {
				targetDiv.innerHTML = o.responseText;
			}
		},
		failure : function(o) {
			if(o.responseText !== undefined) {
				targetDiv.innerHTML = 'Connection error.';
			}
		}
	});
	ItemListTimer = setTimeout("ItemListAnimOn.animate()", 500);
}
var ItemListDefault;
var ItemListAnimOn;
var ItemListAnimOff;
var ItemListTimer;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
	tempX = YAHOO.util.Event.getPageX(e);
	tempY = YAHOO.util.Event.getPageY(e);
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;}
	return true;
}
function highlightOnLoad() {
	var textContainerNode = document.getElementById("CartColContent");
	var searchTerm = "preview";
	var regex = new RegExp(">([^<]*)?("+searchTerm+")([^>]*)?<","ig");
	highlightTextNodes(textContainerNode, regex);
}
function highlightTextNodes(element, regex, termid) {
	var tempinnerHTML = element.innerHTML;
	element.innerHTML = tempinnerHTML.replace(regex,'>$1<a onmouseover="previewWin(\'show\');" onmouseout="previewWin(\'hide\');" class="previewWin">$2</a>$3<');
}
function previewWin(state) {
	var offset = 20;
	tempX = tempX + offset;
	tempY = tempY + offset;
	if (state == 'hide') {
		PreviewOverlay.hide();
	}
	else {
		PreviewOverlay.cfg.setProperty("x", tempX);
		PreviewOverlay.cfg.setProperty("y", tempY);
		PreviewOverlay.show();
	}
}