// JavaScript Document
answ = new Array(0,0,0,0,0,0,0,0);
function Height() {
	with(document) {
		if (getElementById('left').clientHeight-307 < getElementById('content').clientHeight) 
			getElementById('left').style.height=getElementById('content').clientHeight+321+'px';
	}
}
function Class(obj,off,on) {
	(obj.className==off)?obj.className=on:obj.className=off;
}

function ClassRad(id,off,on,obj) {	
	for (i=1; i<=3; i++) document.getElementById('qtest_'+id+i).className=off;
	document.getElementById('qtest_'+id+obj).className=on;
	answ[id] = obj;
}

function CCClass(obj,on,off) {	
	alert(document.getElementById('s'+1).className);
	for (i=1; i<=3; i++) document.getElementById('s'+i).className=off;
	if (document.getElementById(obj) == off) document.getElementById(obj).className=on;
	else document.getElementById(obj).className=off;
}

function GetResultTest (num_t) {
	switch (num_t) {
		case 1: var ransw = new Array(0,2,2,3,2,2,3,2);
				var mass = new Array(100,7,5,3);
				switch (Math.round(Math.random() * 4)) {
					case 0: mssg2 = 'You must be a detective! Your credit card IQ`s gone way up. Safely apply for <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Lowest-APR-Cards.php">best interest free credit cards.</a>'; break;
					case 1: mssg2 = 'Now, that’s impressive! You are a real credit card buff! You surely know how to get the <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Lowest-APR-Cards.php">lowest APR</a> cards.'; break;
					case 2: mssg2 = 'Amazing! You are a real credit card expert. No doubt you can acquire all best <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Cash-Back-Rewards.php">cash back cards.</a>'; break;
					case 3: mssg2 = 'Excellent job! You are definitely a credit card expert! You know how to find <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Cash-Back-Rewards.php">rebate cards.</a>'; break;
					case 4: mssg2 = 'Awesome job!  Our best <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/0-APR-Debt-Consolidation.php">balance transfer cards</a> at your disposal!'; break;
				}
				switch (Math.round(Math.random() * 4)) {
					case 0: mssg3 = 'Some more practice, and you are a real credit card spy! Learn more about <a style="color:#663300; color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/High-Limit-Cards.php">high limit credit cards!</a>'; break;
					case 1: mssg3 = 'You are almost there! Keep reading on <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/No-Annual-Fee-Cards.php">no annual fee</a> cards and you’ll become a real expert!'; break;
					case 2: mssg3 = 'A little more reading on low fee <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Low-Balance-Transfer-Fee.php">balance transfer cards</a> and you will be a credit card specialist!'; break;
					case 3: mssg3 = 'You are close to hitting the target! A little more practice and you will know everything about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Lowest-Cash-Advance-Fees.php">credit cards cash advance!</a>'; break;
					case 4: mssg3 = 'You are one step away from becoming a credit card spy! Learn more about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Instant-Decision-Cards.php">instant approval cards!</a>'; break;
				}
				switch (Math.round(Math.random() * 4)) {
					case 0: mssg4 = 'You still have a way to go in understanding how <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Air-Miles-Rewards.php">air miles</a> work.'; break;
					case 1: mssg4 = 'Nice try! However, there is still a lot to learn about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Hotel-Rewards.php">travel rewards.</a>'; break;
					case 2: mssg4 = 'Seems like you are not a credit card expert yet. Keep learning about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Security-Deposit-Cards.php">easy to get credit cards.</a>'; break;
					case 3: mssg4 = 'Some of those credit card tricks are too much for you yet. Learn more about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Credit-Cards-for-No-Credit.php">first time credit cards.</a>'; break;
					case 4: mssg4 = 'You are on the right track! However, there are still many things about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Credit-Cards-for-Students.php">student credit cards!</a>'; break;
				}					
				script1 = '<table style="background:url(http://Best-Credit-Cards-Spy.com/images/';
				script2 = '); margin:5px;" width="300" height="300"><tr><td style="padding:5px 0 0 0; vertical-align:top; text-align:left; font:normal 11px Arial;"><a href="http://Best-Credit-Cards-Spy.com/Credit-Training-Test.php" style="color:#663300; margin:0 0 0 13px;">Take the Credit Test</a><div style="padding:8px 19px 5px 146px; text-align:center; font:bold 10px Arial;">';
				script3 = '</div></td></tr></table>';				
				break;			
		case 2: var ransw = new Array(0,1,2,3,2,2,1);
				var mass = new Array(100,6,3,0);
				switch (Math.round(Math.random() * 4)) {
					case 0: mssg2 = 'Congratulations! You have showed more than just good knowledge of <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Lowest-APR-Cards.php">lowest rate credit cards</a>. You certainly are able to manage your personal finances perfectly.'; break;
					case 1: mssg2 = 'Well done! You have answered the majority of credit card questions correctly. This means you can be your own perfectly qualified finance manager for <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/No-Annual-Fee-Cards.php">no fee credit cards.</a>'; break;
					case 2: mssg2 = 'You have done very well! You have given correct answers to the majority of questions. You can deal with most matters concerning your <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/High-Limit-Cards.php">high limit credit card</a> without assistance.'; break;
					case 3: mssg2 = 'Excellent! You have provided valid answers to the majority of questions. It shows that you have a decent knowledge of credit card terms and <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Lowest-Cash-Advance-Fees.php">cash advance cards.</a>'; break;
					case 4: mssg2 = 'Very good! You have answered most questions about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Lowest-APR-Cards.php">best rate credit cards</a> correctly.'; break;
				}
				switch (Math.round(Math.random() * 4)) {
					case 0: mssg3 = 'The results of your test are satisfactory. You have some knowledge of <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Low-Balance-Transfer-Fee.php">balance transfer credit cards</a>, but you need to learn a little more.'; break;
					case 1: mssg3 = 'You have shown satisfactory results. You need to catch up with a lot of information on <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/0-APR-Balance-Transfers.php">0% balance transfer credit cards.</a>'; break;
					case 2: mssg3 = 'You have given correct answers to a very little number of questions. You’d better make some revision of <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Personal-Bankruptcy-Cards.php">consumer credit cards.</a>'; break;
					case 3: mssg3 = 'Not many questions have been answered correctly. You need to spend some time learning more about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Bad-Credit-Unsecured-Cards.php">unsecured credit cards.</a>'; break;
					case 4: mssg3 = 'You have not provided correct answers to a decent number of questions. It would be useful for you to learn some more about <a style="color:#663300; font-size:12px;" href="http://Best-Credit-Cards-Spy.com/Credit-Cards-for-No-Credit.php">first time credit cards.</a>'; break;
				}
				mssg4 = '';
				script1 = '<table style="background:url(http://Best-Credit-Cards-Spy.com/images/';
				script2 = '); margin:5px;" width="300" height="300"><tr><td style="padding:5px 0 0 0; vertical-align:top; text-align:left; font:normal 11px Arial;"><a href="http://Best-Credit-Cards-Spy.com/Credit-Level-Test.php" style="color:#663300; margin:0 0 0 13px;">Take the Credit Test</a><div style="margin:60px 0 0 5px; padding:3px; color:#AF9F8A; font:normal 11px Arial; width:108px; background:url(http://Best-Credit-Cards-Spy.com/images/door_bgr.gif) top repeat-y;">';
				script3 = '</div></td></tr></table>';
				break;
	}
	var q = 0;
	var mssg = '';
	for (i = 1; i < ransw.length; i++) {
		if (ransw[i] == answ[i] && q != mass[0]) {
			q++;
			document.getElementById('que'+i).style.color="";
			document.getElementById('answ'+i).style.display="none";
			document.getElementById('atest_'+i+ransw[i]).style.textDecoration="none";
		} else if (answ[i] == 0) {
				q = mass[0];
				document.getElementById('que'+i).style.color="red";
			} else {
				if (ransw[i] == answ[i]) {
					document.getElementById('answ'+i).style.display="none";
					document.getElementById('atest_'+i+ransw[i]).style.textDecoration="none";
				}
				else if (q != mass[0]) {
					document.getElementById('answ'+i).style.display="block";
					document.getElementById('atest_'+i+ransw[i]).style.textDecoration="underline";
				}
				document.getElementById('que'+i).style.color="";
			}
	}
	if (q != mass[0]) {
		if (q > mass[2] && q <= mass[1]) {
			mssg = mssg2;
			(num_t == 1)?st = 'gold.jpg':st = 'open_door.jpg';
		} else if (q > mass[3] && q <= mass[2]) {
			mssg = mssg3;
			(num_t == 1)?st = 'dollars.jpg':st = 'close_door.jpg';
		} else if (q >= 0 && q <= mass[3]) {
			mssg = mssg4;	
			st = 'pure.jpg';
		}
		document.getElementById('answer_block').style.display = 'block';
		document.getElementById('answer').innerHTML = mssg;
		mssg = mssg.substring(0, mssg.indexOf('2px', 0))+'1'+mssg.substring(mssg.indexOf('2px', 0)+1, mssg.length);
		if (num_t == 2) {
			mssg = mssg.substring(0, mssg.indexOf('663300', 0))+'E6D7C3'+mssg.substring(mssg.indexOf('663300', 0)+6, mssg.length);
		} else {
			mssg = mssg.substring(0, mssg.indexOf('11px;', 0))+'10px;'+mssg.substring(mssg.indexOf('11px;', 0)+5, mssg.length);
		}
		script = script1+st+script2+mssg+script3;
		document.getElementById('area_txt').value = script;	
		//document.getElementById('test').innerHTML = script;
		document.getElementById('test_img').innerHTML = script;
	} else document.getElementById('answer_block').style.display = 'none';
}

function Table(count,id) {
	with(document) {
		var m=0,c=0;
		while(c<count) (getElementById(id+(++c)).clientHeight > m)?m=getElementById(id+c).clientHeight:m=m;
		while(c>0) getElementById(id+(c--)).style.height=m+'px';
	}
}
function cu_Head(num) {
	with(document) {
		var i=0;
		while(++i<5) (i==num)?getElementById('h'+i).className='cuh_btn_on':getElementById('h'+i).className='cuh_btn_off';
		form_4371.let_subj.value=num;
		getElementById('cuh').innerHTML=getElementById('c'+num).innerHTML;
	}
}
function testKey(e) {
	var key=(typeof e.charCode=='undefined'?e.keyCode:e.charCode);
	if (e.ctrlKey || e.altKey || key<32) return true;
	key=String.fromCharCode(key);
	return /\d/.test(key);
}
function trim(x) {
	var ch,c;
	ch=x.toString();
	c=ch.charAt(0);
	while(c==" ") { 
		ch=ch.slice(1);
		c=ch.charAt(0);
	}
	c=ch.charAt(ch.length-1);
	while(c==" ") { 
		ch=ch.slice(0,-1);
		c=ch.charAt(ch.length-1);
	}
	return ch;
}
function check_mail(email) { 
	var re = new RegExp("^[\\w\\.-]+@[\\w\\.-]+\\.[A-Za-z]{2,}");
  	return (re.test(email));
}
function pr_Inp(obj,cl,fl) {
	if((fl)?check_mail(obj.value):trim(obj.value)) {
		obj.className=cl;
		return true;
	}
	else {
		obj.className=cl+'_d';
		obj.focus();
		return false;
	}
}
function cu_Form() {
	with(document) {
		var ok=0;
		if(getElementById('cu_not')) Show_Hide('cu_not','c_num');
		if(pr_Inp(form_4371.ch_num,'cuf_num')) ++ok;
		if(pr_Inp(form_4371.bodymessg,'cuf_teta')) ++ok;
		if(pr_Inp(form_4371.question,'cuf_in3')) ++ok;
		if(pr_Inp(form_4371.email,'cuf_in12',true)) ++ok;
		if(pr_Inp(form_4371.fname,'cuf_in12')) ++ok;
		if(ok==5) {
			form_4371.action.value='2';
			form_4371.submit();
		}
	}
}
function comm_Form() {
	with(document) {
		var ok=0;
		if(pr_Inp(form_comm_news.ch_num,'cf_inp3')) ++ok;
		if(pr_Inp(form_comm_news.bodymessg,'cf_tara')) ++ok;
		if(form_comm_news.email.value) if(pr_Inp(form_comm_news.email,'cf_in12',true)) ++ok;
		if(pr_Inp(form_comm_news.fname,'cf_in12')) ++ok;
		if(!form_comm_news.email.value) { 
			if(ok==3) {
				form_comm_news.action.value='post_comm';
				form_comm_news.submit();
			}
		}
		else {
			if(ok==4) {
				form_comm_news.action.value='post_comm';
				form_comm_news.submit();
			}
		}
	}
}
function faq_Form() {
	with(document) {
		var ok=0;
		if(pr_Inp(form_783410.number,'ff_in4')) ++ok;
		if(pr_Inp(form_783410.messg,'ff_in3')) ++ok;
	 	if(form_783410.email.value) if(pr_Inp(form_783410.email,'ff_in2',true)) ++ok;
		if(pr_Inp(form_783410.fname,'ff_in1')) ++ok;
		if(form_783410.email.value) {
			if(ok==4) {
				form_783410.func.value='post_quest';
				form_783410.submit();
			}
		}
		else {
			if(ok==3) {
				form_783410.func.value='post_quest';
				form_783410.submit();
			}
		}
	}
}
function Show_Hide(el1,el2,fl) {
	with(document) {
		getElementById(el1).style.display='none';
		getElementById(el2).style.display='block';
		if(fl) form_4371.ch_num.focus();
	}
}
function ronly(obj) {
	with(document) {
		if(obj.className=='ff_chbx_on') {
			form_783410.email.readOnly=false;
			form_783410.email.focus();
		}
		else {
			form_783410.email.className='ff_in2';
			form_783410.email.value='';
			form_783410.email.readOnly=true;
		}
	}
}
function email_ans() {
	with(document) {
		if(form_783410.email.value) {
			getElementById('fbx').className='ff_chbx_on';
			form_783410.email.readOnly=false;
		}
	}
}
function attr_click(obj) {
	with(document) {
		(obj.value=='Student' || obj.value=='Business')?search_form.attr_find_7177.disabled=true:search_form.attr_find_7177.disabled=false;
	}
}
function serch_Tabcorr(id,id2) {
	with(document) {
		getElementById(id).style.marginBottom=getElementById(id2).clientHeight+'px';	
	}
}
function top_pdt(obj,n) {
	obj.className='top_btn_'+n;
	for (i = 1; i <= 4; i++) {
		if (i != n) {
			document.getElementById('tb'+i).className = 'tbtn';
			document.getElementById('pdt'+i).style.display = 'none';
		}
		else {
			document.getElementById('tb'+i).className = 'tbtn_on';
			document.getElementById('pdt'+i).style.display = 'block';
		}
	}
}
function score(id,fl) {
	if(fl) {
		document.getElementById(id).style.zIndex=1;
		setTimeout("document.getElementById('"+id+"').style.display='block'", 300);
	}
	else {
		document.getElementById(id).style.zIndex=0;
		setTimeout("document.getElementById('"+id+"').style.display=''", 1000);
	}
}
function add_name_t2(n1,n2,n3,n4,n5,n6) {
	with (document) {
		getElementById('an_1').innerHTML = n1;
		getElementById('an_2').innerHTML = n2;
		getElementById('an_3').innerHTML = n3;
		getElementById('an_4').innerHTML = n4;
		getElementById('an_5').innerHTML = n5;
		getElementById('an_6').innerHTML = n6;
	}
}
