/*	L19 Global Application Functions
 *	Version 1.0.0
 *
 *	Developed by, Jeremiah J. Jacks <jjacks@digitalbrandgroup.com>
 *
 *	Copyright (c) 2007-2008 Intensity Sports, Inc.
 *	          (c) 2006-2008 Digital Brand Group, Inc.
 *
 *--------------------------------------------------------------------------*/

// soon to be depreciated - use pwc windows
function ow(theURL,winName,features) { window.open(theURL,winName,features); }
// soon to be depreciated - use css
function ws(w,h) { document.write('<img src="/images/spacer.gif" border="0" width="'+w+'" height="'+h+'" />'); }

// window.onload functions for multi-loading page functionality
var onload_functions = new Array();
function DBG_initOnload() { window.onload = DBG_execOnloadFunctions; }
function DBG_addOnloadFunction(name) { onload_functions[onload_functions.length] = name; }
function DBG_execOnloadFunctions() {
	for(var i = 0; i < onload_functions.length; i++) {
		eval(onload_functions[i]);
	}
}

var css_browser_selector = function() {
	var ua=navigator.userAgent.toLowerCase(),
		is=function(t){ return ua.indexOf(t) != -1; },
		h=document.getElementsByTagName('html')[0],
		b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
		os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
	var c=b+os+' js';
	h.className += h.className?' '+c:c;
}();

// get date for requested utc offset
function getDate(utc_offset) {
	d = new Date();
	utc = d.getTime() + (d.getTimezoneOffset() * 60000);
	return new Date(utc + (3600000 * utc_offset));
}

function checkHeaderSearch() {
	if($('site-search-options').getValue() != 1 && $('site-search-options').getValue() != "" ) {
		top.location.href="/marketplace/?name=MarketplaceSearch&process=true&sortby=&sortorder=&search="+$('site-search').getValue()+"&manufacturer=&"+$('site-search-options').getValue()+"&price_from=&price_to=&brands=";
		return false;
	}
}
function showfriendlink() {
	$('dropdownfriend').show();
	$('friends').hide();
	$('friends_hover').show();
}
function hidefriendlink() {
	$('dropdownfriend').hide();
	$('friends_hover').hide();
	$('friends').show();
}
function showprofilelink() {
	$('dropdownprofile').show();
	$('profile_login_over').show();
	$('profile_login').hide();
}
function hideprofilelink() {
	$('dropdownprofile').hide();
	$('profile_login').show();
	$('profile_login_over').hide();
} 
function showmaillink() {
	$('dropdownmail').show();
	$('mail_login_over').show();
	$('mail_login').hide();
}
function hidemaillink() {
	$('dropdownmail').hide();
	$('mail_login').show();
	$('mail_login_over').hide();
} 
function orgdesc () {
	var t=$('orgtype').value;
	for(var i=1;i<=6;i++)
		{
		var r='orgtypedesc'+i;
		$(r).hide();
		}
	var r1='orgtypedesc'+t;
	$(r1).show()
}
function openPopUp(obj) {
	$('popup').hide();
	add_popup.options.hideOverLay = false;
	obj.show();
}
function cancel_membership(){
	if(confirm("Are you sure to cancel this membership")==true)
		$('cancel_membership1').submit();
	else
		return false;
	
}


 
function check_email(txt_value){
	if(txt_value=="Email"){
		document.getElementById('email_id').value="";
	}
	else if(txt_value==""){
		//document.getElementById('email_id').style.color= "#989898";
		//alert("saada");
		document.getElementById('email_id').value="";
		//document.getElementById('email_id').value="Email";
	}
	
}
function check_email_n(txt_value){
	
	if(txt_value=="Email"){
		document.getElementById('email_id').value="";
	}
	else if(txt_value==""){
		//document.getElementById('email_id').style.color= "#989898";
		//alert("saada");
		//document.getElementById('email_id').value="";
		document.getElementById('email_id').value="Email";
	}
	
	//if(getElementById('email_id').value);
}
function check_pwd(txt_value){
	var field = document.forms['form_login'].elements['password'];
	if(txt_value=="Password"){
		//document.getElementById('password').value="";
	}
	else if(txt_value==""){
		//document.getElementById('password').style.color= "#989898";
		//document.getElementById('password').type="text";
		//document.getElementById('password').value="Password";
		//field.setAttribute("type","password");
	}
}
function make_pwd(txt_value){
	//var field = document.forms['form_login'].elements['password'];
	//alert("saddddd");
	if(txt_value!="Password"){
	//	alert(txt_value);
		//document.getElementById('password').type="password";
		 //field.setAttribute("type","password");
	}
	else {
		//document.getElementById('password').type="text";
		 //field.setAttribute("type","text");
	}
}

function switchto(q){
	if(document.getElementById('form_login')){
       if (q){
           document.getElementById('passwordtext').style.display="none";
            document.getElementById('password').style.display="inline";
           document.getElementById('password').focus();
       } else {
          document.getElementById('password').style.display="none";
            document.getElementById('passwordtext').style.display="inline";
       }
	}
   }

	
	