﻿//-----------------------------------------------------------------------
function scrollessWindowOpen(url,width,height)
{	
	var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2 - 30;
    window.open(url, '', 'dependent=yes, width=' + width + 'px, height=' + height + ',left=' + winl + ',top=' + wint);
}		
//----------------------------------------------------------
function scrollableWindowOpen(url,width,height)
{	
	var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2;
    window.open(url, '_blank', 'directories=no, fullscreen=no, height=' + height + ', width=' + width + ', location=no, menubar=no, resizable=no, scrollbars=yes, status=no, titlebar=no, toolbar=no, top=' + wint + ', left=' + winl + '', 'bReplace=false');
}		
//----------------------------------------------------------
function textCounter(field, countfield, maxlimit) 
{	
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
	else
		countfield.innerHTML = maxlimit - field.value.length;
}	
//---------------------------------------------------------------------------------
function clickButton(e, buttonid)
{ 
    var bt = document.getElementById(buttonid); 
    if (typeof bt == 'object')
    {	
        if (is_ie)
        {       
            if (event.keyCode == 13)
            {	
                bt.click(); 
                return false; 
            }   
        }       
        if(is_nav)
        {	    
            if (e.keyCode == 13)
            {   
                bt.click(); 
                return false; 
            }   
        }       
    }           
}               
//------------------------------------------------------------------
function ChangeHeader(cmbHeader, flashContainer, width, height)
{	
	var strSelected		= cmbHeader.options[cmbHeader.selectedIndex].value;
	var arrTmp			= strSelected.split(".");
	var strExtension	= arrTmp[arrTmp.length-1];
	if (strSelected != '' && strExtension == 'swf')
	{	
		strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + width + '" height="' + height + '" VIEWASTEXT>\n' + 
						'<param name="wmode"	value="opaque">\n' + 
						'<param name="movie"	value="Flash/' + strSelected + '">\n' + 
						'<param name="quality"	value="high">\n' + 
						'<param name="scale"	value="noborder">\n' + 
						'<param name="bgcolor"	value="#ffffff">\n' + 
						'<embed src="Flash/' + strSelected + '" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>\n' + 
					'</object>\n';
		document.getElementById(flashContainer).innerHTML = strFlash;
	}	
	else if (strSelected != '' && (strExtension == 'jpg' || strExtension == 'gif'))
	{	
		document.getElementById(flashContainer).innerHTML = '<img src="Flash/' + strSelected + '">';
	}	
}
//------------------------------------------------------------------
//function to add events to be fired when a page loads
function addLoadEvent(func) 
{
    var oldonload = window.onload;
    if (typeof window.onload != 'function') 
    {
        window.onload = func;
    } 
    else 
    {
        window.onload = function() 
        {
            if (oldonload) 
            {
                oldonload();
            }
            func();
        }
    }
}
//------------------------------------------------------------------
