﻿function main()
{

}

function mediaPopup(url)
{
    var objWindow = window.open(url, 'mediaPopup');
    objWindow.focus();
}

function changeLang(strLang)
{
    var strLocationSearch = location.search;

    if (strLocationSearch.toLowerCase().indexOf('lang_id=') > -1)
    {
        strLocationSearch = strLocationSearch.replace(/lang_id=./i, 'lang_id=' + strLang);
    }
    else if (strLocationSearch.length)
    {
        strLocationSearch += '&lang_id=' + strLang;
    }
    else
    {
        strLocationSearch = '?lang_id=' + strLang;
    }
    location.href = location.protocol + '//' + location.host + location.pathname + strLocationSearch + location.hash;
}

function MPLoadMovie(strMediaPath) 
{
    //alert(strMediaPath);
    if ( document.getElementById('mediaPlayer') )
    {
        if (!document.all)
        {
            document.mediaPlayerEmbeed.src = strMediaPath;
            //document.mediaPlayerEmbeed.play();
           alert(typeof(document.mediaPlayerEmbeed));
        }
        else {
            document.getElementById('mediaPlayer').filename = strMediaPath;
        }
        
    }
    else if ( document.getElementById('mediaPlayer10') )
    {
        document.getElementById('mediaPlayer10').url = strMediaPath;
    }
}

function PicutureViewerLoad(strMediaPath, objViewer) 
{
    if ( document.getElementById(objViewer) )
    {
        document.getElementById(objViewer).src = strMediaPath;
    }
}

function _collapse(obj, me)
{
	obj.style.display = 'none';
	me.innerHTML = '<img src="' + StrAppRoot + 'Images/TreeView/col.gif" style="border-width:0px;" />';
}

function _expand(obj, me)
{
	obj.style.display = 'block';
	me.innerHTML = '<img src="' + StrAppRoot + 'Images/TreeView/exp.gif" style="border-width:0px;" />';
}

function toggleCollapse(targetId, me)
{
	if (! document.getElementById) return;
	var obj = document.getElementById(targetId);
	if (! obj) return;

	if (obj.style.display != 'none') {
		_collapse(obj, me)
	}
	else {
		_expand(obj, me)
	}
}
var timmer = null;
function mapHandler()
{   
    showFindDistributorForm();
}
function showFindDistributorForm()
{
    if (document.all)
    {
        timmer = setTimeout("renderControl(0)", '250');
    }
    else
    {
        renderControl(0);
    }
}
function getMap(intNavId, charLangId)
{
    window.clearTimeout(timmer);
    timmer = null;
    hideHiddenContactForm();
    renderControlImap(intNavId)
}
function getDistributorsFor(intNavId, charLangId)
{
    window.clearTimeout(timmer);
    timmer = null;
    hideHiddenContactForm();
    showZipCodeSearchResults();
    renderControl(intNavId);
}
function showZipCodeSearchResults()
{
    obj = document.getElementById('ZipCodeSearchResults');
    if (obj)
    {
        obj.style.display = 'none';
    }
}
function showHiddenContactForm()
{
    obj = document.getElementById('hiddenContactForm');
    if (obj)
    {
        obj.style.display = 'block';
    }
}
function hideHiddenContactForm()
{
    obj = document.getElementById('hiddenContactForm');
    if (obj)
    {
        obj.style.display = 'none';
    }
}
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
onload = main;
