/*!
 * Common JavaScript File
 * http://www.e-works.am/
 *
 * Copyright 2010
 */

$(document).ready(function(){
	showHide("fname", "First Name");
	showHide("lname", "Last Name");
	showHide("phone", "555-555-5555");
	showHide("fullname", "Full Name");
	showHide("email", "Email Address");
	
	var booktex = '<a rel="nofollow" href="http://www.facebook.com/share.php?u=http://www.texasphonedirectory.org/" title="" target="_blank"><img src="/img/ico-facebook.jpg" width="22" height="22" alt="" ></a> <a rel="nofollow" href="http://www.myspace.com/auth/loginform?dest=http://www.myspace.com/Modules/PostTo/Pages/default.aspx%3fu%3dhttp%253A%252F%252Fwww.texasphonedirectory.org/" title="" target="_blank"><img src="/img/ico-myspace.jpg" width="22" height="22" alt="" ></a> <a rel="nofollow" href="http://twitter.com/share?url=http%3A%2F%2Fwww.texasphonedirectory.org%2F&via=AddThis&text=Texas%20Phone%20Numbers%20%E2%80%93%20TexasPhoneDirectory.org&" title="" target="_blank"><img src="/img/ico-twiter.jpg" width="22" height="22" alt="" ></a>';
		
	$("#bookmarkid").html(booktex);
});
		
function showHide(id, value){
	
	var tmp = $('#'+id).val();
	
	if(tmp == ''){
		$('#'+id).val(value);
	}

	$('#'+id).bind('focus',function() {
		if ($(this).val() == value) {
			$(this).val('');
		}
	});

	$('#'+id).bind('blur',function() {
		if ($(this).val() == '') {
			$(this).val(value);
		}
	});
}

function EmptyNameChk(){
	var txt="Please fill in the following to continue:";
	var fname = $("#fname").val();
	var lname = $("#lname").val();

	if (fname=="" || fname=="First Name") {
		txt=txt+"\n First Name";
		alert(txt);
		return false;
	}
	
	if (lname=="" || lname=="Last Name") {
		txt=txt+"\n Last Name";
		alert(txt);
		return false;
	}
	
	return true;

}

function EmptyPhoneChk(){
	var txt="Please fill in the following to continue:";
	var phone = $("#phone").val();
	var strlen = phone.length;

	if (phone=="" || phone=="555-555-5555" || strlen < 10) {
		txt=txt+"\n Correct phone number";
		alert(txt);
		return false;
	}

	return true;
}

function EmptyFormChk(){
	var txt="Please fill in the following to continue:";
	var fullname = $("#fullname").val();
	var email = $("#email").val();

	if (fullname =="" || fullname =="Full Name") {
		txt=txt+"\n Full Name";
		alert(txt);
		return false;
	}
	return true;
}

$(document).ready(function() {
	$('#RadioGroup1_0').click(function(){
		$('#url').attr('value', 'http://zhiro.eregistry2.hop.clickbank.net/?xpath=signup&x_site=eregistry2&gc_price=94gc_source=g');
		$('#type').attr('value', 'Ultimate');
	})
	$('#RadioGroup1_1').click(function(){
		$('#url').attr('value', 'http://zhiro.eregistry2.hop.clickbank.net/?xpath=signup&x_site=eregistry2&gc_price=93gc_source=g');
		$('#type').attr('value', 'Standard');
	})
	$('#RadioGroup1_2').click(function(){
		$('#url').attr('value', 'http://zhiro.eregistry2.hop.clickbank.net/?xpath=signup&x_site=eregistry2&gc_price=92gc_source=g');
		$('#type').attr('value', 'Basic');
	})
	
});

$(document).ready(function() {
	$('#namesearch').submit(function() {
		var nameansver = EmptyNameChk();
		if(nameansver){
  			return true;
		}
		return false;
	});

	$('#phonesearch').submit(function() {
		var phoneansver = EmptyPhoneChk();
		if(phoneansver){
  			return true;
		}
		return false;
	});
});


	
