function PromoRedirect(url){
	location.href=url;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ChangeClass(ID, Class){
	document.getElementById(ID).className=Class;
}

function JoinReq(t){
	if(t["00N80000002c6VD"].value == "" || t["company"].value == "" || t["first_name"].value == "" || t["last_name"].value == "" || t["email"].value == "" || t["phone"].value == "" || t["00N80000002c6WB"].value == ""){
		alert("Please provide all required information.");
		return false;
	} else {
		return true;
	}
}

function CheckBoxCheck(type){
	if(type == 0){
		if(document.Q2OnlineLogin.forgot_password[0].checked){
			document.Q2OnlineLogin.forgot_password[1].checked = false;
			document.Q2OnlineLogin.password.disabled = true;
			document.Q2OnlineLogin.password.style.backgroundColor = "#E5E5E5";
		} else {
			document.Q2OnlineLogin.password.disabled = false;
			document.Q2OnlineLogin.password.style.backgroundColor = "#FFFFFF";
		}
	} else if(type == 1){
		if(document.Q2OnlineLogin.forgot_password[1].checked){
			document.Q2OnlineLogin.forgot_password[0].checked = false;
			document.Q2OnlineLogin.password.disabled = true;
			document.Q2OnlineLogin.password.style.backgroundColor = "#E5E5E5";
		} else {
			document.Q2OnlineLogin.password.disabled = false;
			document.Q2OnlineLogin.password.style.backgroundColor = "#FFFFFF";
		}
	}
}

function ToggleShowHide(x){
	if(x == "Member Invite"){
		document.getElementById("InvitedBy").style.display = "inline";
	}
	else {
		document.getElementById("InvitedBy").style.display = "none";
	}
}

function WebinarLink(){
	var qs = new Querystring();
	var CorrelationID = qs.get('_kt','');
	var CorrelationData = qs.get('_kk','');
	var CampaignID = qs.get('CampaignID','');
	document.write("<a href=\"default.aspx?v=1d0d9e72-10c6-41d1-895c-ac7a634d14c6&CampaignID=" + CampaignID + "&CorrelationID=" + CorrelationID + "&CorrelationData=" + CorrelationData +"\"><strong>Upcoming Webinars</strong></a>");
}

function NewsletterLink(){
	var qs = new Querystring();
	var CorrelationData = qs.get('_kk','');
	var Policy = qs.get('Policy','');
	document.write("<a href=\"default.aspx?v=1d0d9e72-10c6-41d1-895c-ac7a634d14c6&CorrelationData=" + CorrelationData +"&Policy=" + Policy + \"><strong>CLICK HERE TO GET YOUR FREE POLICY</strong></a>");
}

function WebinarHidden(){
	var qs = new Querystring();
	var CorrelationID = qs.get('CorrelationID','');
	var CorrelationData = qs.get('CorrelationData','');
	var CampaignID = qs.get('CampaignID','');
	document.write("<input type=\"hidden\" name=\"Campaign_ID\" value=\"" + CampaignID + "\" />");
	document.write("<input type=\"hidden\" name=\"00N80000002bKsH\" value=\"" + CorrelationID + "\" />");
	document.write("<input type=\"hidden\" name=\"00N80000002bKsI\" value=\"" + CorrelationData + "\" />");
}

function NewsletterHidden(){
	var qs = new Querystring();
	var CorrelationData = qs.get('CorrelationData','');
	var Policy = qs.get('Policy','');
	document.write("<input type=\"hidden\" name=\"Keywords\" value=\"" + CorrelationData + "\" />");
	document.write("<input type=\"hidden\" name=\"Policy\" value=\"" + Policy + "\" />");
}

function RetUrl(){
	document.form1.retURL.value = "http://www.cbancnetwork.com/webinar/webinar.aspx?WebinarID=" + document.form1.WebinarID.value + "&company=" + document.form1.company.value + "&first_name=" + document.form1.first_name.value + "&last_name=" + document.form1.last_name.value + "&email=" + document.form1.email.value + "&phone=" + document.form1.email.value + "&JobTitle=" + document.form1.JobTitle.value + "&Address_City=" + document.form1.Address_City.value + "&Address_State=" + document.form1.Address_State.value;
}


function Querystring(qs) {
// optionally pass a querystring to parse
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}



function RandomQuoteLeft(){
	messages = new Array(5);
	messages[0] = '<strong>&quot;</strong>I&rsquo;ve been in banking for 10 years and have never seen anything like this before.&nbsp; I&rsquo;ve been able to spend more time testing and polishing products because I didn&rsquo;t have to dredge through agreements and legal wording as I would have without cbanc exchange.<strong>&quot;</strong><div class="QuoteBy">Shannon Armentor<br/>St Martin Bank &amp; Trust</div>';
	messages[1] = '<strong>&quot;</strong>Two words sum up cbanc for me:<br/>cutting edge.<strong>&quot;</strong><div class="QuoteBy">Ron Taylor<br/>Wayne County Bank</div>';
	messages[2] = '<strong>&quot;</strong>Vendor Management is an excellent tool.  Keep up the great work!<strong>&quot;</strong><div class="QuoteBy">Ron Taylor<br/>Wayne County Bank</div>';
	messages[3] = '<strong>&quot;</strong>I was so impressed with the originality and creativity behind cbanc.  Who knew there was ANYTHING innovative left in banking!<strong>&quot;</strong><div class="QuoteBy">Suzanne Dondanville, COO<br/>Community Bank, Pasadena, CA</div>';
	messages[4] = '<strong>&quot;</strong>cbanc has not only met but surpassed our expectations, and I believe is a tool that all financial institutions must have.<strong>&quot;</strong><div class="QuoteBy">Carlos Morales<br/>Herring Bank</div>';
	index = Math.floor(Math.random() * messages.length);
	document.write(messages[index]);
}

function RandomQuoteRight(){
	messages = new Array(4);
	messages[0] = '<div class="QuoteDesc">Comment from member who bought a Pandemic Influenza policy:</div><strong>&quot;</strong>This policy will save me about 4 days worth of work! It contains so much information (33 pages) that covers every aspect of Pandemic Planning that I could think of. Great job!<strong>&quot;</strong><div class="QuoteBy">Jeff Miller<br/>Lakeside Bank</div>';
	messages[1] = '<strong>&quot;</strong>After 12 years of banking I\'m finally impressed. Cbanc exchange is a banker\'s best friend. It saves so much time. There is no more aggravation on trying to find the right words or worrying about legal aspects. It\'s already there and ready to go.<strong>&quot;</strong><div class="QuoteBy">Ginger McClure<br/>FNB Bank</div>';
	messages[2] = '<strong>&quot;</strong>I&rsquo;m new to cbanc, and I&rsquo;m very impressed; can&rsquo;t wait to show this to all my banking friends! cbanc is a no brainer for any banker!<strong>&quot;</strong><div class="QuoteBy">Franklin Weber<br/>State National Bank</div>';
	messages[3] = '<strong>&quot;</strong>... I highly recommend cbanc to all community banks that have an appreciation, as we do, for accessing and sharing information with others in the community bank segment that are faced with the challenge of competing with larger national banks ...<strong>&quot;</strong><div class="QuoteBy">Suzanne Krenz<br/>MidSouth Bank</div>';
	messages[4] = '<strong>&quot;</strong>We have found the cbanc Exchange to be very user friendly!  We earn points quickly by selling our content on the network. As a result, we\'ve taken these points and purchased other content we needed saving ourselves hours of time!<strong>&quot;</strong><div class="QuoteBy">Sue Besselievre<br/>Kitsap Bank</div>';
	index = Math.floor(Math.random() * messages.length);
	document.write(messages[index]);
}

function validateDataSimple(t){
	for (i=0; i<t.length; i++) {
		if (t[i].alt == undefined){
			Alt = "0";
		} else {
			Alt = t[i].alt;
		}
		if(Alt.indexOf("num") != -1 && !t[i].value.match(/^\d+$/)){
			showMessage(t[i].id, "Please enter a number with no text.");
			return false;
		}
		if(Alt.indexOf("jpg") != -1 && t[i].value != "" && t[i].value.indexOf(".jpg") == -1){
			alert(t[i].value + "Please use .jpg photo files.");
			return false;
		}
		if(t[i].value == "" && Alt.indexOf("req") != -1 && t[i].type != "checkbox"){
			alert("Please verify that you have entered all required information.");
			return false;
		} else if(t[i].type == "checkbox" && Alt.indexOf("req") != -1){
			if(!t[i].checked){
				alert("Please verify that you have entered all required information.");
				return false;
			}
		} else if(t[i].value == "" && t[i].type == "textarea" && t[i].title.indexOf("req") != -1){
			alert("Please verify that you have entered all required information.");
			return false;
		} else if(t[i].value == "0" && t[i].type == "select-one" && t[i].title.indexOf("req") != -1){
			alert("Please verify that you have entered all required information.");
			return false;
		} else if(t[i].value == "" && t[i].type == "select-multiple" && t[i].title.indexOf("req") != -1){
			alert("Please verify that you have entered all required information.");
			return false;
		}
	}
	return true;
}