// JavaScript Source

function disableAction(){
	return false;}
	
function stopRKey(evt) {
   var evt = (evt) ? evt : ((event) ? event : null);
   var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
   if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}	

function TF_ToolBar(){ 
 if(navigator.appVersion.indexOf("MSIE")==-1){return;}
 var i,k,g,lg,r=/\s*p7hvr/,nn='',c,cs='p7hvr',bv='tf_toolbar';
 for(i=0;i<10;i++){g=document.getElementById(bv+nn);if(g){
 lg=g.getElementsByTagName("LI");if(lg){for(k=0;k<lg.length;k++){
 lg[k].onmouseover=function(){c=this.className;cl=(c)?c+' '+cs:cs;
 this.className=cl;};lg[k].onmouseout=function(){c=this.className;
 this.className=(c)?c.replace(r,''):'';};}}}nn=i+1;}
}

function checkData(a){
	var field=a.value;if(field=="" || field==null || field=="0"){a.setAttribute("class", "registerError");}else{a.setAttribute("class", "register");}		
}

function textCounter(field, countfield, maxlimit) {
	if(field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}else{
		countfield.value = maxlimit - field.value.length;}
}

// LOAD STATUS
function updateStatus(id){document.getElementById(id).innerHTML='<div class=\'loading_SML\' align=\'left\'></div>';}


function validate_edit_member(thisform)
{
	var alias=document.my_profile.alias
	var fname=document.my_profile.fname
	var lname=document.my_profile.lname
	var month=document.my_profile.month
	var day=document.my_profile.day
	var year=document.my_profile.year
	var hometown=document.my_profile.hometown
	var t_size=document.my_profile.t_size
	var h_size=document.my_profile.h_size
	
	  if ((alias.value==null)||(alias.value=="")){
		alert("You forgot to enter your ALIAS or ScreenName. This is how others will identify you.")
		alias.focus()
		return false }	
	  if ((fname.value==null)||(fname.value=="")){
		alert("You forgot to enter your FIRST NAME! I know we didn't ask for it at registration, but come on... Toss us a bone.")
		fname.focus()
		return false }	
	  if ((lname.value==null)||(lname.value=="")){
		alert("You forgot to enter your LAST NAME! I know we didn't ask for it at registration, but come on... Toss us a bone.")
		lname.focus()
		return false }	
	  if ((month.value=="0") || (month.value==0)){
		alert("You forgot to enter your BIRTH MONTH")
		month.focus()
		return false }	
	  if ((day.value=="0") || (day.value==0)){
		alert("You forgot to enter your BIRTH DAY")
		day.focus()
		return false }	
	  if ((year.value=="0") || (year.value==0)){
		alert("You forgot to enter your BIRTH YEAR")
		year.focus()
		return false }	
	  if ((hometown.value=="") || (hometown.value==null)){
		alert("You forgot to enter your HOMETOWN")
		hometown.focus()
		return false }	
	  if ((t_size.value=="0") || (t_size.value==0)){
		alert("You forgot to enter your T-SHIRT SIZE")
		t_size.focus()
		return false }	
	  if ((h_size.value=="0") || (h_size.value==0)){
		alert("You forgot to enter your HOODIE SIZE")
		h_size.focus()
		return false }	
}

function validate_change_password(thisform)
{
	var new_password=document.change_pass.new_pass
	var passwordconfirm=document.change_pass.confirm_pass
  
  if (new_password.value.length<5){
		alert("Please enter a valid PASSWORD of atleast 5 characters.")
		new_password.focus()
		return false }
				
  if (passwordconfirm.value!=new_password.value){
		alert("Your CONFIRMED PASSWORD does not match.")
		passwordconfirm.focus()
		return false }		

}

function validate_edit_member_email(thisform)
{
  var new_username=document.edit_email.email
  
  if (new_username.value.length<5){
		alert("Please enter a valid EMAIL ADDRESS. Your email address will be used for authentication only.")
		new_username.focus()
		return false }
}

function validate_edit_member_pass(thisform)
{
var password=document.edit_pass.password
var new_password=document.edit_pass.new_password
var passwordconfirm=document.edit_pass.confirm_password

   if (password.value.length<5){
		alert("Please enter your CURRENT PASSWORD")
		password.focus()
		return false }
 
 if (new_password.value.length<5){
		alert("Please enter a NEW PASSWORD of atleast 5 characters.")
		new_password.focus()
		return false }
				
  if (passwordconfirm.value!=new_password.value){
		alert("Your CONFIRMED PASSWORD does not match.")
		passwordconfirm.focus()
		return false }		
}


function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}


function VerifySloganApproval(thisform)
{  var action=document.slogans.action
	  if (action.value=="0"){
		alert("Please enter a valid ACTION")
		action.focus()
		return false
       }
}


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_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 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 checkUncheckAll(theElement) {
 var theForm = theElement.form, z = 0;
 for(z=0; z<theForm.length;z++){
  if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
  theForm[z].checked = theElement.checked;
  }
 }
}

function validate_send_user_message(theMessage) {
	var message=document.user_message.send_message
	
	   if (message.value.length<2){
		alert("Please enter a valid MESSAGE!")
		message.focus()
		return false }
}

function validate_graphics_upload(data) {
	var file=document.graphics_upload.uploadedfile
	var title=document.graphics_upload.title
	var info=document.graphics_upload.info
	var agree=document.graphics_upload.terms

if (file.value.length<5){
		alert("You forgot to add an IMAGE")
		file.focus()
		return false }
		
	   if (title.value.length<1){
		alert("You forgot to add a TITLE")
		title.focus()
		return false }
		
	   if (info.value.length<5){
		alert("Please enter better INFO on this design.")
		info.focus()
		return false }
		
		if (agree.checked!=1){
		alert("You must declair ownership of this image.")
		agree.focus()
		return false }
}

function CopyBilling(theElement) {
 var b_zip=document.edit_account.b_zip;
 var s_zip=document.edit_account.s_zip;
 alert("Hi");
 s_zip=b_zip;

}

function addtext() {
	var fname = document.edit_account.b_fname.value;
	var lname = document.edit_account.b_lname.value;
	var company = document.edit_account.b_company.value;
	var address = document.edit_account.b_address.value;
	var city = document.edit_account.b_city.value;
	var state = document.edit_account.b_state.value;
	var zip = document.edit_account.b_zip.value;
	
	if (document.edit_account.copy.checked) {
		document.getElementById('s_fname').value=fname;
		document.getElementById('s_lname').value=lname;
		document.getElementById('s_company').value=company;
		document.getElementById('s_address').value=address;
		document.getElementById('s_city').value=city;
		document.getElementById('s_state').value=state;
		document.getElementById('s_zip').value=zip;
	}
}

function validate_edit_account(data){
	var b_fname=document.edit_account.b_fname;
	var b_lname=document.edit_account.b_lname;
	var b_address=document.edit_account.b_address;
	var b_city=document.edit_account.b_city;
	var b_state=document.edit_account.b_state;
	var b_zip=document.edit_account.b_zip;
	var s_fname=document.edit_account.s_fname;
	var s_lname=document.edit_account.s_lname;
	var s_address=document.edit_account.s_address;
	var s_city=document.edit_account.s_city;
	var s_state=document.edit_account.s_state;
	var s_zip=document.edit_account.s_zip;
	
	if (b_fname.value.length<1){
		alert("You forgot to enter a FIRST NAME in your BILLING ADDRESS!")
		b_fname.focus()
		return false }
	if (b_lname.value.length<1){
		alert("You forgot to enter a LAST NAME in your BILLING ADDRESS!")
		b_lname.focus()
		return false }
	if (b_address.value.length<3){
		alert("You forgot to enter a BILLING ADDRESS!")
		b_address.focus()
		return false }
	if (b_city.value.length<2){
		alert("You forgot to enter a CITY in your BILLING ADDRESS!")
		b_city.focus()
		return false }
	if (b_state.value.length<2){
		alert("You forgot to enter a STATE in your BILLING ADDRESS!")
		b_state.focus()
		return false }
	if (b_zip.value.length<5){
		alert("You forgot to enter a ZIP CODE in your BILLING ADDRESS!")
		b_zip.focus()
		return false }
		
	if (s_fname.value.length<1){
		alert("You forgot to enter a FIRST NAME in your SHIPPING ADDRESS!")
		s_fname.focus()
		return false }
	if (s_lname.value.length<1){
		alert("You forgot to enter a LAST NAME in your SHIPPING ADDRESS!")
		s_lname.focus()
		return false }
	if (s_address.value.length<3){
		alert("You forgot to enter a SHIPPING ADDRESS!")
		s_address.focus()
		return false }
	if (s_city.value.length<2){
		alert("You forgot to enter a CITY in your SHIPPING ADDRESS!")
		s_city.focus()
		return false }
	if (s_state.value.length<2){
		alert("You forgot to enter a STATE in your SHIPPING ADDRESS!")
		s_state.focus()
		return false }
	if (s_zip.value.length<5){
		alert("You forgot to enter a ZIP CODE in your SHIPPING ADDRESS!")
		s_zip.focus()
		return false }
}

function checkLength( element, maxLength ){
  var len = element.value.length
  if (len > maxLength) {
    element.value = element.value.substr(0,maxLength);
    len = maxLength;
  }
  if ( element.value == "Please limit your text to less than " + maxLength + " characters." ) {
    document.getElementById('remChars').innerHTML = maxLength;
  } else {
    document.getElementById('remChars').innerHTML = maxLength - len;
  }
}

function roll(obj, highlightcolor, textcolor){
	obj.style.backgroundColor = highlightcolor;
	obj.style.color = textcolor;
}





var tooltip=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 300;
	var speed = 10;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();

function SloganSubmit(text){
	var slogan=document.slogansubmit.slogan
	
	   if (slogan.value.length<1){
		alert("Please enter a valid SLOGAN!")
		slogan.focus()
		return false }
}

function confirmAction(txt) {var answer = confirm(txt);if (answer){return true;}else{return false;}}
function validEmail(email){var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;return (reg.test(email) == false)? false:true;}

