// Detect Gogrok availability in IE and Firefox.
// 2008-07-30 by Chen Xudong <chenxudong@hotmail.com>

var DetectMode;
if ( navigator.userAgent.indexOf('Safari') != -1
	 || navigator.userAgent.indexOf('Opera') != -1 ) {
	DetectMode = -1;
} else if ( navigator.userAgent.indexOf('Win') != -1
	 && navigator.userAgent.indexOf('MSIE') != -1
	 && parseInt(navigator.appVersion) >= 4 ) {
	DetectMode = 1;
	document.write(['<script type="text/javascript">',
		'function DetectActiveX(activex_name)',
		'{',
		'	try {',
		'		var o = new ActiveXObject(activex_name);',
		'		if (o) return 1;',
		'	} catch (err) {',
		'	}',
		'	return 0;',
		'}',
		'</script>'].join("\n") );
} else {
	DetectMode = 0;
}

function DetectObject (activex_name, mime_type)
{
	if (DetectMode == -1) {
        return -1;
    } else if (DetectMode == 1) {
		return DetectActiveX(activex_name);
    } else {
        var m = navigator.mimeTypes[mime_type];
        if (typeof(m) == "object") return 1;
    }
    return 0;
}

function DetectGogrok (hrefLink)
{
	var gg=DetectObject("Gogrok.ErrorObject", "application/x-gogrok");
        if(gg==0)
        { window.open.location="http://www.gogrok.com/en/Gogrok_Detection.html";
          
        }else if(gg==1){
				window.location=hrefLink;
		}
      //  return gg;
}
