var $j = jQuery.noConflict();

$j(document).ready(function() {
	if ($j('#tweets').length	> 0){					   
		$j(".tweet").tweet({
				  join_text: "auto",
				  username: "LoveShoesDE",
				  count: 3,
				  loading_text: "Lesen Sie unsere aktuellen LoveThoseShoes Tweets…"
				});	

		window.setInterval("$j('.tweet').html(''); $j('.tweet').tweet({  join_text: 'auto',  username: 'LoveShoesDE',  count: 3, loading_text: 'Lesen Sie unsere aktuellen LoveThoseShoes Tweets…'});",60000);
	}
	
	$j("a[rel='chgcurr']").colorbox({width:400, height:250, opacity : 0.5});
	$j("a[rel='chgcurr2']").colorbox({width:400, height:250, opacity : 0.5});
	
	$j("a[rel='showadv']").colorbox({width:400, height:250, opacity : 0.5});
	
	$j("a[id='ATB']").colorbox({width:980, height:550, opacity : 0.5});

	$j(document).bind('cbox_open', function(){
        selectedSizeID = "";
	});

	$j(document).bind('cbox_complete', function(){
	    wireInSizes();
	});

	if(typeof fireATB != 'undefined'){
		if (fireATB == "Y") $j("#ATB").click();
	}
 
	function megaHoverOver(){
		
		$j(this).find(".sub").stop().fadeTo('fast', 1).show();
			
		//Calculate width of all ul's
		(function($j) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				jQuery(this).find("ul").each(function() {
					rowWidth += $j(this).width(); 
				});	
			};
		})(jQuery); 
		
		if ( $j(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$j(this).find(".row").each(function() {							   
				$j(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			//$(this).find(".sub").css({'width' : biggestRow});
			//$(this).find(".row:last").css({'margin':'0'});
			
		} else { //If row does not exist...
			
			//$(this).calcSubWidth();
			//Set Width
			//$(this).find(".sub").css({'width' : rowWidth});
			
		}
	}
	
	function megaHoverOut(){ 
	  $j(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $j(this).hide(); 
	  });
	}
 
 
	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 100, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 500, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
 
	$j("ul#topnav li .sub").css({'opacity':'0'});
	$j("ul#topnav li").hoverIntent(config);
 
 
});
function closeAndConvert(iCurrency){

window.location = "/updatecurrency.asp?Currency=" + iCurrency
parent.$j.fn.colorbox.close();
return true;

}

function validateSearchTerms()
{
if (($('search').value == "Search Website...." || $('search').value == "") && $('bAdvanced').value == "false")
{
	alert("Bitte wählen Sie etwas zu suchen. Vielen Dank!");
	return false;
}
else
{
	parent.$.fn.colorbox.close();
	return true;
}

}
