
$(document).ready(function(){
    roundedCorners();
  
    $('a[title=Settings]').click(function()
	{
	//alert('test');
	//alert($(this).next('div.searcharea').value);
	//alert($(this).html());
	    var test = $(this).parent().parent().parent().parent().parent().parent().find('.rdContent').find('.settingsArea');
	  //alert(test.attr('class')); 
	    
	   
		/*$(this).parent().parent().next('div.rdContent')..$('div.searcharea')slideToggle();
		*/
		test.slideToggle('fast');
		$(this).toggleClass('searchup');
		//alert("test2");
	});
	
	$('.jq_Click').click(function(){
	    //alert("jq_Click");
	    var thisClick = this;
	    $('.jq_Ref').each(function(i){
	        var current = this;    	    
	        var btn = $(current).find('.jq_Click');	        
	        if(btn.attr('id') == $(thisClick).attr('id')){
	            if($(thisClick).hasClass('hasTitle')){
	                $(current).find('.rdTitle').html($(current).find('.jq_Title').attr('value'));
	            }
	            $(current).find('a[title=Settings]').click();	            
	        }

	    });
	});
	
});
function roundedCorners(){
    $(".roundedWhite").each(function(){
		eval($("code", this).text());
	});
    $(".roundedGrey").each(function(){
		eval($("code", this).text());
	});
	 $(".roundedBlue").each(function(){
		eval($("code", this).text());
	});
	
	 $(".mainAreaRSS").each(function(){
		eval($("code", this).text());
	});
	$(".mainAreaCourses").each(function(){
		eval($("code", this).text());
	});
	$(".mainAreaCareprosis").each(function(){
		eval($("code", this).text());
	});
	$(".mainAreaBulletins").each(function(){
		eval($("code", this).text());
	});
	$(".mainAreaFaq").each(function(){
		eval($("code", this).text());
	});
	$(".mainAreaPhotos").each(function(){
		eval($("code", this).text());
	});
	$(".mainAreaTags").each(function(){
		eval($("code", this).text());
	});
	var page = $.find('.gadgetList');	
	if(page=="")
	{ 	
	    
	    var divWidth = $(".Photos").width();
	    var imgWidth = $(".imgPhoto").width();
     
	    $(".imgPhoto").width(divWidth)
	    
	    var imgHeight = $(".imgPhoto").height();	     	   
	}
	else
	{
	   
	    var divWidth = $(".mainAreaPhotos").width();
        var imgWidth = $(".imgPhoto").width();
        
        
         
	    if($.browser.msie && $.browser.version=="6.0")
	    {
	    $(".mainAreaPhotos").width(divWidth-20);
	    $(".imgPhoto").width(divWidth-20);
	    }
	    else
	    {$(".mainAreaPhotos").width(divWidth-8);
	    $(".imgPhoto").width(divWidth-8);
	    }
	    
	    var imgHeight = $(".imgPhoto").height();
	    
	    
	}
	/*
	var page = $.find('.gadgetList');	
	if(page=="")
	{ 	
	    $(".mainAreaPhotos").each(function(){	 	     
		eval($("code.1", this).text());
    	});
	    var divWidth = $(".Photos").width();
	    var imgWidth = $(".imgPhoto").width();
     
	    $(".imgPhoto").width(divWidth)
	    
	    var imgHeight = $(".imgPhoto").height();	     	   
	}
	else
	{
	    $(".mainAreaPhotos").each(function(){		    
		    eval($("code", this).text());
	    });
	    var divWidth = $(".mainAreaPhotos").width();
        var imgWidth = $(".imgPhoto").width();
         
	    $(".imgPhoto").width(divWidth)
	    var imgHeight = $(".imgPhoto").height();
	    
	    
	}
	*/
	
}

function re_init(){
    re_StartInit();
    //setTimeout('re_StartInit()',500);
}

function re_StartInit(){
    
   $('a.settings').unbind("click");
   $('a.settings').click(function()
    {
        //alert('test');
    //alert($(this).next('div.searcharea').value);
        var test = $(this).parent().parent().next('.rdContent').children(0).children('.settingsArea');
	    
	    
	   
	    /*$(this).parent().parent().next('div.rdContent')..$('div.searcharea')slideToggle();
	    */
	    test.slideToggle('fast');
	    $('a.settings').toggleClass('searchup');
	    //alert("test2");
    });
	$('.jq_Click').unbind("click").click(function(){

	    var thisClick = this;
	    $('.jq_Ref').each(function(i){
	        var current = this;    	    
	        var btn = $(current).find('.jq_Click');	        
	        if(btn.attr('id') == $(thisClick).attr('id')){
	            if($(thisClick).hasClass('hasTitle')){
	                $(current).find('.rdTitle').html($(current).find('.jq_Title').attr('value'));
	            }
	            $(current).find('a.settings').click();	            
	        }

	    });
	});
    /*$('.jq_Ref').each(function(i){
        var current = this;
        var button = $(current).find('.hasTitle');
        alert(i);
        $(current).find('.boldbuttons').unbind("click").click(function(){
            $(current).find('a.settings').click();
        });
        
        if(button != null){
            button.click(function(){
                //alert($(current).find('.jq_Title').val());
                $(current).find('.rdTitle').html($(current).find('.jq_Title').attr('value'));
            });
        }
	    
        

    }); */
    roundedCorners();
}
	

