// Name:            CountryFlag.js
// Desctiption:     Easy Script for Display the Countryflag in the ProductPage
// Author:          Roger Camiu
// Company:         ricardo.ch

$(document).ready(function() 
{
try{
    if ($('#county').length) {
        var country = $('#county').text();   
        var schweiz = country.search(/Schweiz/);
        var suisse = country.search(/Suisse/);
        
        $("#county").append(' <img id="CountryFlag" src="/imgweb/2/V4/special/flags/none.gif"\>');
        if (schweiz != -1 || suisse != -1)
        {} else {    
            $.get('/imgweb/2/V4/special/flags/' + country + '.gif',{},
            function(msg,status){  
                $('#CountryFlag').attr('src', '/imgweb/2/V4/special/flags/' + country + '.gif');    
                if (status == "success")
                {
                    $('#CountryFlag').attr('src', '/imgweb/2/V4/special/flags/' + country + '.gif');    
                } else {
                    $('#CountryFlag').remove();    
                }
            }).error(function(){$('#CountryFlag').remove(); });      
        }
    }
}catch (e){
    
}
});
