	
	var brand;
	var model;
	
	var Site = {
	
		start: function() {
		
			var containers = $$('.menuItem');
			containers.each(function(el, i) {
				Site.createOver(el, i);
			});
		
			
			var itemsRight = $$('.rightMenuItem');
			itemsRight.each(function(el, i) {
				Site.createOverRight(el, i);
			});
		
			if (window.ie6) {
				$('bg1').setStyles({'background-image': 'url("/img/ie6BG.gif")', 'background-position': 'center top', 'background-repeat': 'no-repeat'});
				$('bg2').setStyles({'background-image': 'url("/img/ie6BG2.gif")', 'background-repeat': 'repeat-y'});
			}
			
		},
		
		createOver: function(el, i) {
			var menuFx = [];		
			menuFx[i] = new Fx.Styles(el,{duration: 1200,transition: Fx.Transitions.quadOut, wait: false});
			el.addEvent('mouseover', function(e) {
				e = new Event(e).stop();
				menuFx[i].start({
								'height':[32],
								'margin-top':[50]
								});
			});
			el.addEvent('mouseout', function(e) {
				e = new Event(e).stop();
				menuFx[i].start({
								'height':[32],
								'margin-top':[53]
								
								});
			})
		},
		
		createOverRight: function(el, i) {
			var itemsRight = $$('.rightMenuItem');
			var menuFxRight = [];		
			menuFxRight[i] = new Fx.Style(itemsRight[i], 'padding-left',{duration: 250,transition: Fx.Transitions.quadOut, wait: false});
			el.addEvent('mouseover', function(e) {
				e = new Event(e).stop();
				menuFxRight[i].start(15);
			});
			el.addEvent('mouseout', function(e) {
				e = new Event(e).stop();
				menuFxRight[i].start(5);
			})
			
		},
		
		removeLightBox: function() {
			overlay.remove();
			vC.remove();
		},
		
		createLightBox: function() {
			overlay = new Element('div', {'id': 'lbOverlay'}).injectInside(document.body);
			overlay.setStyles({
								position: 'absolute',
								top: '0px',
								left: '0px',
								height: window.getScrollHeight() + 'px',
								width: window.getScrollWidth() + 'px',
								'background-color': '#000'
							  });
			overlay.setOpacity(0),
			overlay.effect('opacity',{duration: 300}).start(0,1);
			Site.createFlashBox.delay('500');
			
		},
		
		createFlashBox: function()	{
			vC = new Element('div', {'id': 'videoContainer'}).injectInside(document.body);
			vC.setStyles({
								width: '850px',
								height: '440px',
								position: 'absolute',
   								top: '50%',
   								left: '50%',
   								margin: '-245px 0px 0px -425px'
								});

			lwi = '<div style="width: 850px; text-align = right;"><a href="javascript:Site.removeLightBox()"><img src="img/close.gif" width="77" height="19" style="margin-bottom:30px; margin-left: 750px;"></a></div><iframe id="lightWindow-iframe" name="lightWindow-iframe" height="450" width="850" frameborder="0" scrolling="no" ></iframe>';
			vC.innerHTML = lwi;
			var iframeContent = '<html><head><style type="text/css">*, html, body{ margin: 0px; padding: 0px; background-color: black;}</style></head><body><embed pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" src="swf/player2.swf" name="lightWindow-media" id="lightWindow-media" quality="high" wmode="opaque" width="850" height="450"/></body></html>';
			if ($('lightWindow-iframe').contentWindow){
				$('lightWindow-iframe').contentWindow.document.open();
				$('lightWindow-iframe').contentWindow.document.write(iframeContent);
				$('lightWindow-iframe').contentWindow.document.close();
			} else {
				$('lightWindow-iframe').contentDocument.open();
				$('lightWindow-iframe').contentDocument.write(iframeContent);
				$('lightWindow-iframe').contentDocument.close();
			}
			},
			
			
	submitDoc: function(formName) { 
 		$(formName).submit();
	}, 
		
	aLoad: function(lo)	{
		var brands = $$('#brand a');
		brands.each(function(el, i) {
			el.setStyle('color','#4D91FF');
		});
		$(lo).setStyle('color','#f58d58');
		$('brandd').value = lo;

		//var myUrl = 'http://www.tricastmail.com/modelV2.php?brand='+lo;
		
		var myUrl = 'modelV2.php?brand='+lo;
	
		new Ajax(myUrl, {
		method: 'get',
		update: 'model'
		}).request();
		brand = lo;
		//$("brandName").innerHTML = lo;
	},
	
	checkMobile: function(mobile) {
		var mobiles = $$('#model a');
		mobiles.each(function(el, i) {
			el.setStyle('color', '#4D91FF');
		});
		$('mmodel').value = mobile;
		if($(mobile).name == 1) {
			$('applicationId').value = "1";
			$('V1only_Badge').setStyle('visibility','visible');
			$('note').setStyle('visibility','visible');
		} else {
			$('applicationId').value = "2";
			$('V1only_Badge').setStyle('visibility','hidden');
			$('note').setStyle('visibility','hidden');
		}
		$(mobile).setStyle('color','#f58d58');
		$("Download").setStyle('visibility','visible');
		$("phoneImage").innerHTML = '<img src="Phone_Thumbnails/' + mobile + '.jpg"/>';
		$("phoneName").innerHTML = $(mobile).innerHTML;
		$("brandName").setStyle('visibility','visible');
		$("brandName").innerHTML = brand;
		//$('productOptions').value = mobile;
		model = mobile;
		//var scroll = window.getScroll();
		//if (scroll.y() > 250) {
		//var myFx = new Fx.Scroll(window, {offset: {'x': 0, 'y': 250}}).toTop();
		//window.scrollTo(0,250);
		//}


	},
	
	buildAccordion: function() {
		new Accordion($$('#accordionExample h3'), $$('#accordionExample div'));
	},
	
	changeImg: function(image, source) {
	$(image).src = source
	}
		

}

	
		
		

window.addEvent('load', Site.start);