// Copyright SEGA Technical Services Ltd. 2009

// disable jQuery from using $ in scripts (prevents conflict w/ prototype scripts)
jQuery.noConflict();

//taken from SEGAPoker.com - by Sherwin Ocubillo
function openWindow(url,title,size) { 
	
	arr_size = size.split('x');
	
	width = arr_size[0];
	height = arr_size[1];
	
	myLightWindow.activateWindow({
	      href: url,
	      title: title,
	      width: width,
	      height: height,
	      type: 'external'
	});	
}

jQuery(document).ready(function() {
	
	// payment logo links
	jQuery('.banking-link').click(function(){
		if (jQuery(this).attr('href')) {
			openWindow(jQuery(this).attr('href'), 'SEGA Partner Banking', '700x600');
		}
		return false;
	});
	
	// payment plans - mgr check
	jQuery('#payment-plans-mgr-check').click(function(){
		if (jQuery(this).attr('href')) {
			window.open(jQuery(this).attr('href'), 'SEGAPartners.com', 'width=537,height=1076,scrollbars=yes');
		}
		return false;
	});
	
	// scrolling banner
	jQuery('#scrolling-container').scrollFollow( { offset: 33 } );
	
	// toggle FAQ glossary items
	glo_id_sel = 'glossary-index-a';   // Default Glosarry showed

	jQuery('ol.faq-list h3').click(function() {
		
		id = this.id;
		
		var faq_class = jQuery('ol.faq-list div#' + id + '-answer')[0].className;
		
		if(faq_class != 'viewed') {
			jQuery('ol.faq-list div#' + id + '-answer').show('clip',{},500);
			jQuery('ol.faq-list div#' + id + '-answer').addClass('viewed');
		} else {				
			jQuery('ol.faq-list div#' + id + '-answer').hide('clip',{},500);
			jQuery('ol.faq-list div#' + id + '-answer').removeClass('viewed');
		}

	});
	
	jQuery('div#content-box-body #glossary-alphabets a').click(function() {
	
		id = this.id;
		
		// Hide the currently showed Glossary
		jQuery('div#content-box-body ul#' + glo_id_sel + '-information').removeClass('glossary-show');  
		jQuery('div#content-box-body ul#' + glo_id_sel + '-information').addClass('glossary-hide');
		
		// Show the selected Glossary
		jQuery('div#content-box-body ul#' + id + '-information').removeClass('glossary-hide');
		jQuery('div#content-box-body ul#' + id + '-information').show('blind',{},500);	
		
		// Show the indicator for the selected Alphabet
		jQuery('div#content-box-body #glossary-alphabets a#' + id).addClass('glossary-selected');  
		jQuery('div#content-box-body #glossary-alphabets a#' + glo_id_sel).removeClass('glossary-selected');
		
		glo_id_sel = id;			  	
	});
	
});