$nym=jQuery.noConflict();



$nym(document).ready(function(){

	$nym('#body').css('min-height',$nym(window).height()-$nym('#head').innerHeight()-$nym('#tail').innerHeight());
	
	nvc=1;
	sidemhidden='';
	$nym('.UC122MenuLevel1 > tbody > tr').each(function(){
		
		if(nvc>10){ sidemhidden='sidemenu-item-hidden'; }
		$nym(this).addClass('sidemenu-item-'+nvc+' '+sidemhidden);
		nvc++;
		});

	
	/*FANCY MENU*/
	cl=1;
	$nym('#siteMenu_pnlMain > ul > li').each(function(){ 
	$nym(this).addClass('lvl1-'+cl); 
	$nym(this).find('ul').addClass('lvl2-'+cl); 
	cl++; 
	});
	$nym('#head .holder').append($nym('.SiteMenu .selected .SecondLevel').addClass('appended-menu'));
	
	ssw=$nym('.appended-menu ul').innerWidth();
	mmw=$nym('#ml2-container').innerWidth();
	new_mmw=ssw+mmw+40;
	$nym('#ml2-container').animate({width:new_mmw+'px'}, 300);
	$nym('.SecondLevel').animate({opacity:1.00},1000);
	
	$nym('body').addClass('nothree');
	$nym('#thirdColumn').parents('body').removeClass('nothree').addClass('three-cols');
	
	$nym('.lvl1-1.selected').parents('body').addClass('orange-theme');
	$nym('.lvl1-2.selected').parents('body').addClass('blue-theme nothome');
	$nym('.lvl1-3.selected').parents('body').addClass('green-theme nothome');
	$nym('.lvl1-4.selected').parents('body').addClass('red-theme nothome');
	
	/*FANCY BOX*/
	
	cl=1;
	$nym('#pnlRad2 > div').each(function(){
		$nym(this).addClass('box-'+cl+' fbox');
		cl++;
		});
	$nym('.box-3 .LinkImageList2, .box-4 .UC129MiddleBox, .orange-theme #secondColumn .UC129MiddleBox').append('<table border="0" cellspacing="0" cellpadding="0"><tr><td></td></tr></table>');
	
	$nym('.orange-theme #secondColumn .UC129MiddleBox').wrap('<div class="box-4 fbox"></div>');
	
	$nym('.box-3 .LinkImageList2 table td').append($nym('.box-3 .Item'));
	$nym('.box-4 .MiddleBox').prepend($nym('.box-4 .MainTitleContainer'));	
	$nym('.box-4 .MiddleBox > table td').append($nym('.box-4 .UC129MainContainer, .box-4 .UC129SummaryContainer'));
	
	$nym('.GroupCol.box-1').animate({height:'toggle'},400);	
	$nym('.GroupCol.box-2').animate({height:'toggle'},450);	
	$nym('.GroupCol.box-3').animate({height:'toggle'},500);	
	$nym('.GroupCol.box-4').animate({height:'toggle'},550);	
	
	/*FORMS*/
	ht=$nym('.UC129ContactInfoCont > div, .UC129CommentCont, .UC1004ContactInfoCont > div, .UC1004CommentCont, .UC1004ExtraFieldsCont > div').each(function(){
			ht=$nym(this).find('.FormLabel').html().replace(':','');
			$nym(this).find('.FormBox, .FormMultiBox').attr('value',ht);
		});
	
	$nym('.nothree.green-theme #secondColumn .UC111MainContainer, .green-theme #thirdColumn .UC111MainContainer').wrap('<div class="box-2 fbox"></div>');
	$nym('.nothree.blue-theme #secondColumn .UC111MainContainer, .blue-theme #thirdColumn .UC111MainContainer').wrap('<div class="box-1 fbox"></div>');
	$nym('.nothree.red-theme #secondColumn .UC111MainContainer, .red-theme #thirdColumn .UC111MainContainer').wrap('<div class="box-3 fbox"></div>');
	
	$nym('.fbox td .Item:last-child').addClass('last');
	
	/*Add Class to product box wrapper, NO IE7 lags!
	!!!!!!!!!!!!!!!!!!!!! If you use this copy this to CSS and SET MAGRIN betwen boxes !!!!!!!!!!!!!!!!!!!!
	.item  {margin-left:10px;}
	.item.first  {margin-left:0px;}
	*/
	$nym('.ProdItemContainer  > div, .ProdItemContainerAlt  > div, .ListItemContainer > div, .ListItemContainerAlt > div').addClass('item');
	$nym('tr').find('.item:first').addClass('first');
	
});



// FORM AUTOVALUES
$nym(document).ready(function(){

	function populateElement(selector, defvalue) {
		$nym(selector).focus(function() {
			if ($nym(selector).val() == 'Website') {
				$nym(selector).val('http://');
			} else if ($nym(selector).val() == defvalue) {
				$nym(selector).val('');
			}
		});

		$nym(selector).blur(function() {
				if ($nym.trim($nym(selector).val()) == '') {
						$nym(selector).val(defvalue);
				}
		});
	};

	$nym('form').find('input[type="text"], input[type="password"], textarea').each(function() {
				populateElement($nym(this), $nym(this).val());
			}
	);

});

//



