function switcheroo(which)
{ 
   if((which=='word') && ($('#word_passwd').css('display')!='none'))
   {
      $('#word_passwd').css('display','none');
      $('#real_passwd').css('display','');
      $('#real_passwd').focus();
   }
   if((which=='real') && ( $('#real_passwd').val()==''))
   {
     $('#real_passwd').css('display','none');
     $('#word_passwd').css('display','');
   }
}
function swap_sponsored_index() 
{
   $('#free_box').css('display','none');
   $('#sponsored').css('display', '');
   $('#free_box').attr('disabled',true);
   $('#sponsored').attr('disabled',false);
}
function swap_free_index() 
{
   $('#sponsored').css('display', 'none');
   $('#free_box').css('display','');
   $('#sponsored').attr('disabled',true);
   $('#free_box').attr('disabled',false);
}
function swap_sponsored_other() 
{
   $('#free_box_other').css('display','none');
   $('#sponsored_other').css('display', '');
   $('#free_box_other').attr('disabled',true);
   $('#sponsored_other').attr('disabled',false);
}
function swap_free_other() 
{
   $('#sponsored_other').css('display', 'none');
   $('#free_box_other').css('display','');
   $('#sponsored_other').attr('disabled',true);
   $('#free_box_other').attr('disabled',false);
}
var scrOfX = 0, scrOfY = 0;
var curpos = 0;
var startpos = 90;
var isIE6Compiliant = false;
var timerHandleOfFloatBox = null;
var delta = 0;

function setScrollPos() {
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft!=null || document.documentElement.scrollTop != null ) ) {
		//IE6 standards compliant mode
		scrOfY = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
		scrOfX = document.documentElement.scrollLeft;
		if ( isIE6Compiliant ) { // if IE 6
		    delta = 0;
			startpos = 70;
		} 
	}
}

function floatingBoxesScroll(){
			var obj=$('#floatingBoxes');
			var sspos = obj.position().top;
			var delay='slow';
			setScrollPos();
			if(scrOfY >= 0 && scrOfY < startpos) {
				if (scrOfY != 0) {
					if (isIE6Compiliant) // IE 6 
	     			   obj.animate({'marginTop': (0 + delta)+'px'},delay);
					else
					   obj.animate({'marginTop': (0 + delta  - scrOfY)+'px'},delay);
				} else
	   			   obj.animate({'marginTop': (0 + delta)+'px'},delay);
			}
			else {
				if (isIE6Compiliant)
				    obj.animate({'marginTop':(scrOfY + delta - 120)+'px'},delay);
				else
	 			    obj.animate({'marginTop':(-120)+'px'},delay);
			}
	   }
	$(window).bind('load', function() 
	{
		isIE6Compiliant = (jQuery.browser.version == '6.0' && jQuery.browser.msie);
		if($('#floatingBoxesAreDisabed').length || !$('#floatingBoxes').length)
			return;	
	   $(window).scroll(
	   	function()
	   	{
	   		clearTimeout(timerHandleOfFloatBox);
	   		timerHandleOfFloatBox=setTimeout(floatingBoxesScroll,100);
	   	}
	   	);
});


//once the dom is ready
function checkAllEnable()
{
	$('#spcheckall').bind('click', 
		function() 
		{
			if(!$('#spcheckall').attr('checked') )
				$('.spcheckbox').attr('checked',false); 
			else 
				$('.spcheckbox').attr('checked',true); 
		}
		);
}

function enableAdvancedFeatures() {
	//hide all answers
//	$(document).pngFix(); 
//	$('#bg').ifixpng(); 
//	$('*').ifixpng(); 
	var faq=$('dl.faq');
	if(faq.length)
	{	
		$('[id]',faq).css('display','none');
		//for every question div
		$('.newFont',faq).click(
				function() 
				{
					$('#'+$(this).attr('rel')).toggle(500);
					return false;
				}
				);
//		$('.answer',faq).css('display','block');
	}
	//Checkall Checkboxx Script
	checkAllEnable();
	opensearchInit();
}

$(window).ready(enableAdvancedFeatures);

function checkMe(element) {
    if(element.checked == false) $('#spcheckall').attr('checked',false);
}

function opensearchVisibility()
{
	var o=$('#openSearch');
	o.css('visibility',o.position().left<925 || $(document).scrollTop()>60?'hidden':'visible');
}

function opensearchInit()
{
  if(window.opensearchName && $('#openSearch').length)	
  {
  	var yes=0;
  	if(jQuery.browser.msie)
  		yes=parseFloat(jQuery.browser.version)>6;
  	else
    if(window.external)
 	  if(window.external.AddSearchProvider)
 	  	yes=1;
 	if(yes)
 	{  	
 		if(!jQuery.cookie('noopsrc'))
 		{
 			opensearchVisibility();	
 			setInterval(opensearchVisibility,500);
 			$('#openSearch').css('display','block');
 			$('#openSearch .close a').bind('click',
 					function(e) 
 					{
 						jQuery.cookie('noopsrc', '1', {expires: 60, path : '/'});
 						$('#openSearch').css('display','none');
 						return false;
 					}
 				)
 				;
 			$('#openSearch .txt a').bind('click',
 					function(e)
 					{
 						window.external.AddSearchProvider(window.opensearchName+'/opensearch.php');
 						return false;
 					}
 				)
 				;
 			return;
 		}
 		else
 			return;
 		jQuery.cookie('noopsrc', '1', {expires: 60, path : '/'});	
  }
  }
  else
  	jQuery.cookie('noopsrc', '1', {expires: 60, path : '/'});
}

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

function isValidEmail(email)
{
	var email_regexp = /^[a-z0-9\._-]+@[a-z0-9][a-z0-9_-]*(\.[a-z0-9_-]+)*\.([a-z]{2,6})$/i;     
    return email_regexp.test(email);
}
if(tplv=='f2')
{
	$('.faqs li h4 a').click(function() {
								
		$(this).parent().next().slideToggle(300);
		
		return false;
		
	});
}