/**
 * Checks whether the Ticker was opener in a popup window
 *
 * @return void
 */
function checkForPopup()
{
    if (!self.opener) {
        self.location = 'http://www.welt.de/';
    }
}

/**
 * Opens the Ticker in a new window
 *
 * @param String
 * @param String
 * @return void
 */
function showTicker(size, file)
{
    var size_str = '';
    
    switch (size) {
        default:
        case 'normal':
            size_str += 'width=400,height=600';
            break;
//      case 'small':
//          size_str += ',height=545';
//          break;
        case 'big':
            size_str += 'width=805,height=600';
            break;
    }
    
    self.open(file, 'ticker',
              'left=100,top=100,status=no,resizable=no,' + size_str);
}

/**
 * Resizes the browser window to fit the size of the small ticker
 *
 * @return void
 */
function switchTickerSmall()
{
//  self.resizeTo(200, 570);
}

/**
 * Resizes the browser window to fit the size of the medium ticker
 *
 * @return void
 */
function switchTickerNormal()
{
	var img = document.getElementById('header');
	img.src = '/images/header_small.gif';
    self.resizeTo(410, 627);
}

/**
 * Resizes the browser window to fit the size of the big ticker
 *
 * @return void
 */
function switchTickerBig()
{
	document.getElementById('header').src = '/images/header_big.gif';
    self.resizeTo(805, 627);
}

/**
 */
function checkFlashClient()
{
    var minreqversion = 7;
    
    var flashinstalled = 0;
    var flashversion = 0;
    if (navigator.plugins && navigator.plugins.length) {
        x = navigator.plugins["Shockwave Flash"];
        if (x) {
            flashinstalled = 2;
            if (x.description) {
                y = x.description;
                flashversion = y.charAt(y.indexOf('.')-1);
            }
        } else {
            flashinstalled = 1;
        }
        if (navigator.plugins["Shockwave Flash 2.0"]) {
            flashinstalled = 2;
            flashversion = 2;
        }
    } else if (navigator.mimeTypes && navigator.mimeTypes.length) {
        x = navigator.mimeTypes['application/x-shockwave-flash'];
        if (x && x.enabledPlugin) {
            flashinstalled = 2;
        } else {
            flashinstalled = 1;
        }
    } else {
        // IE flash detection.
        for (var i = 8; i > 0; i--) {
            flashversion = 0;
            try {
                new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
            } catch (e) {
                continue;
            }
            flashversion = i;
            break;
        }
    }
    
    return (flashversion >= minreqversion);
}

