$( window ).load( function(){
	$('.row th, .row td').hover(
		function(){
			$(this).parent().addClass( 'row-hover' );
		},
		function() {
			$(this).parent().removeClass( 'row-hover' );
		}
	);
	checkMT();
});

function filterStores() {
	window.location = '/' + gLang + '/store/' + $( '#city_filter' ).val() + '/' + $( '#brand_filter' ).val();
}

function openStore( storeId, storeTitle ) {
	Shadowbox.open( {content: '/' + gLang + '/store/view/' + storeId, player: 'iframe', title: storeTitle, width: '934', height: '440' } );
	$( '#city_filter' ).css( 'visibility', 'hidden' );
	$( '#brand_filter' ).css( 'visibility', 'hidden' );
}

function displaySelects() {
	$( '#city_filter' ).css( 'visibility', 'visible' );
	$( '#brand_filter' ).css( 'visibility', 'visible' );
}

function checkMT() {
	var mts = $( 'a' );
	for( var i = 0; i < mts.length; i++ ) {
		var mt = mts[ i ].toString();
		var mto = mts[ i ];
		if( mt.substr( 7, 2 ) == 'mt' ) {
			mt = mt.substr( 10, ( mt.length - 10 ) );
			pos = mt.indexOf( '/' );
			var part3 = mt.substring( 0, pos );
			mt = mt.substr( (pos + 1), ( mt.length - ( pos + 1 ) ) );
			pos = mt.indexOf( '/' );
			var part1 = mt.substring( 0, pos );
			mt = mt.substr( (pos + 1), ( mt.length - ( pos + 1 ) ) );
			pos = mt.indexOf( '/' );
			var body = mt.substring( 0, pos );
			mto.href = 'mailto:' + part1 + '@' + mt.substr( (pos + 1), ( mt.length - ( pos + 1 ) ) ) + '.' + part3;
			if( mto.rel == 'body' ) {
				mto.innerHTML = part1 + '@' + mt.substr( (pos + 1), ( mt.length - ( pos + 1 ) ) ) + '.' + part3;
			}
		}
	}
}
