/*rstw
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
 * $Rev: 5685 $
 */
$(document).ready(function(){
	$(".socb_ign").click(function() {
		$(".socb").toggle(300);
		$(this).blur();
		return false;
	});
		$("#rstw-ee, #rsfl-ee, #rsfb-ee, #rsme-ee, #rsco-ee, #rsma-ee").click(function() { $(this).blur();});
	 
	var closeInf = function() {
		$("#rstw-ee, #rsfl-ee, #rsfb-ee, #rsme-ee, #rsco-ee, #rsma-ee").hide();
	}
	$("#rstw-e, #rsfl-e, #rsfb-e, #rsme-e, #rsco-e, #rsma-e").mouseover(
		function() {
			var el = $('#' + $(this).attr("id") + 'e');
			if(el.css('display') == 'none') {
				closeInf();
				el.fadeIn(1000);
				el.fadeOut(1000);
				
			}
		}
	);
	$("#rstw-e, #rsfl-e, #rsfb-e, #rsme-e, #rsco-e, #rsma-e").mouseout(function() {
	if($(this).css('display') == 'none') { closeInf();
																									  }});
	$("#rstw-ee, #rsfl-ee, #rsfb-ee, #rsme-ee, #rsco-ee, #rsma-ee").click(function() {
		switch($(this).attr('id')){
			case 'rstw-ee':
				document.location.href='http://www.twitter.com/tikkamasalasf';
				break;
			case 'rsfl-ee':
				document.location.href='http://www.flickr.com/photos/tikkamasalasf';
				break;
			case 'rsfb-ee':
				document.location.href='http://www.facebook.com/pages/TikkaMasala/70846977174';
				break;
				case 'rsme-ee':
				document.location.href='menu.pdf';
				break;
				case 'rsco-ee':
				document.location.href='http://maps.google.com/coupons/page?oi=lbc&did=0_8004212862580252438&hl=en-US&gl=US" title="Get Directions';
				break;
				case 'rsma-ee':
				document.location.href='http://maps.google.com/maps?hl=en&ie=UTF-8&q=Tikka+Masala+sf&fb=1&split=1&gl=us&dtab=2&ei=8f4MSqfQNIj4tAOds6jqAg&cid=8004212862580252438&li=lmd';
				break;
		}});
	if(typeof(flashCnt) != 'undefined' && flashCnt.length > 0){var fO = {}; for(c=0;c<flashCnt.length;c++){fO = flashCnt[c];swfobject.embedSWF(fO.movie, fO.id, fO.width, fO.height, '8', '', fO.fvObj, fO.fvObj);}}

	var impbsa = [];
	$.each(adObj, function(i, val){
		var set = val.settings, ads, tmp, oc='';
		if($('#' + set.renderto).length > 0) {
			if(typeof(val.ads) != 'undefined')
				ads = val.ads.ad.length > 1 ? val.ads.ad : val.ads;
			else
				ads = [];
			tmp = '';
			if(set.adhere !== '1')
				$('#' + set.renderto).html('<br class="clear" />');
			$.each(ads, function(j, a){
				oc = a.src == 'bsa' ? ' onclick="_bsa.rocks(\'click\','+a.id+','+set.zone+')"' : '';
				if(set.type == 'txt') {
					$('#' + set.renderto).prepend('<a id="'+set.renderto+a.src+'-'+set.zone+'-'+a.id+'" href="' + a.link + '" class="link' + (a.src=='bsa' ? " bsa" : " outbound") + '" rel="external nofollow" title="' + a.alt + '"'+oc+'>' + a.alt + '</a><br />');
				} else {
					$('#' + set.renderto).prepend('<a id="'+set.renderto+a.src+'-'+set.zone+'-'+a.id+'" href="' + a.link + '" class="' + (a.src=='bsa' ? "bsa" : "outbound") + '" rel="external nofollow" title="' + a.alt + '"'+oc+'><img src="' + a.image + '" alt="' + a.alt + '" class="nobor" width="'+set.width+'" height="'+set.height+'" /></a>');
				}
				if(a.src == 'bsa') {
					tmp += a.id + ';';
				}
			});
			impbsa.push({p: tmp, z: set.zone});
		}
	});

	var promoF = function() {
		var bgPos = 400 * Math.floor(Math.random()*6);
		//if($('#h_promo')) {
			$('#h_promo').css("background-position", "0 -" + bgPos + "px");
		//}
	}
	setInterval(promoF, 2500);

	$("a[rel*='external']").each(function(){$(this).attr("target", "_blank")});
	$(".ext").each(function(){$(this).attr("target", "_blank")});	
	for(var c=0;c<impbsa.length;c++) _bsa.rocks('imp',impbsa[c].p,impbsa[c].z);
});
