// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") +
        (path ? "; path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    now = now.toGMTString();
    if (f.author != undefined)
       setCookie('mtcmtauth', f.author.value, now, '/', '', '');
    if (f.email != undefined)
       setCookie('mtcmtmail', f.email.value, now, '/', '', '');
    if (f.url != undefined)
       setCookie('mtcmthome', f.url.value, now, '/', '', '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '/', '');
    deleteCookie('mtcmthome', '/', '');
    deleteCookie('mtcmtauth', '/', '');
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}

function hideDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'none';
}

function showDocumentElement(id) {
    var el = document.getElementById(id);
    if (el) el.style.display = 'block';
}

var commenter_name;

function individualArchivesOnLoad(commenter_name) {

    hideDocumentElement('trackbacks-info');



    if (document.comments_form) {
        if (!commenter_name && (document.comments_form.email != undefined) &&
            (mtcmtmail = getCookie("mtcmtmail")))
            document.comments_form.email.value = mtcmtmail;
        if (!commenter_name && (document.comments_form.author != undefined) &&
            (mtcmtauth = getCookie("mtcmtauth")))
            document.comments_form.author.value = mtcmtauth;
        if (document.comments_form.url != undefined && 
            (mtcmthome = getCookie("mtcmthome")))
            document.comments_form.url.value = mtcmthome;
        if (document.comments_form["bakecookie"]) {
            if (mtcmtauth || mtcmthome) {
                document.comments_form.bakecookie.checked = true;
            } else {
                document.comments_form.bakecookie.checked = false;
            }
        }
    }
}

function writeTypeKeyGreeting(commenter_name, entry_id) {

}



//Check Flash Plugin
var flash_Flag;
var pluginspageURL = "http://www.macromedia.com/go/getflashplayer";
var codebaseURL = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab";
var query = location.search;
function playerCheck(versionNum){
	ContentVersion = versionNum;
	plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i){if (isNaN(parseInt(words[i])))continue; PluginVersion = words[i]; }
		flash_Flag = PluginVersion >= ContentVersion;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); 
		document.write('on error resume next \n');
		document.write('flash_Flag = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ContentVersion)))\n');
		document.write('</SCR' + 'IPT\> \n');
	}
	
}

//Load Flash Player
function load_player(FlashObject){
	playerCheck(FlashObject.contentVersion);
	if (FlashObject.codebaseVersion) codebaseURL += '#version=' + FlashObject.codebaseVersion;
	if ( flash_Flag ) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + codebaseURL + '"');
		document.write(' width="' + FlashObject.width + '" height="' + FlashObject.height + '"');
		if (FlashObject.id)      document.write(' id="' + FlashObject.id + '"');		
		if (FlashObject.align)   document.write(' align="' + FlashObject.align + '"');
		document.write('>');
		document.write('<param name="movie" value="' + FlashObject.src + '"' + '>');		
		if (FlashObject.play)    document.write('<param name="play" value="' + FlashObject.play + '"' + '>');		
		if (FlashObject.loop)    document.write('<param name="loop" value="' + FlashObject.loop + '"' + '>');           
		if (FlashObject.quality) document.write('<param name="quality" value="' + FlashObject.quality + '">');          
		if (FlashObject.bgcolor) document.write('<param name="bgcolor" value="' + FlashObject.bgcolor + '">');          
		if (FlashObject.scale)   document.write('<param name="scale" value="' + FlashObject.scale + '"' + '>');         
		if (FlashObject.salign)  document.write('<param name="salign" value="' + FlashObject.salign + '"' + '>');       
		if (FlashObject.base)    document.write('<param name="base" value="' + FlashObject.base + '"' + '>');           
		if (FlashObject.menu)    document.write('<param name="menu" value="' + FlashObject.menu + '"' + '>');           
		if (FlashObject.wmode)   document.write('<param name="wmode" value="' + FlashObject.wmode + '"' + '>');         
		document.write('<embed src="' + FlashObject.src + '" width="' + FlashObject.width + '" height="' + FlashObject.height + '"');
		if (FlashObject.play)    document.write(' play="' + FlashObject.play + '"');				
		if (FlashObject.swLiveConnect) document.write(' swliveconnect="' + FlashObject.swLiveConnect + '"');    
		if (FlashObject.quality) document.write(' quality="' + FlashObject.quality + '"');                      
		if (FlashObject.bgcolor) document.write(' bgcolor="' + FlashObject.bgcolor + '"');                      
		if (FlashObject.scale)   document.write(' scale="' + FlashObject.scale + '"');                          
		if (FlashObject.align)   document.write(' align="' + FlashObject.align + '"');                          
		if (FlashObject.salign)  document.write(' salign="' + FlashObject.salign + '"');                        
		if (FlashObject.base)    document.write(' base="' + FlashObject.base + '"');                            
		if (FlashObject.menu)    document.write(' menu="' + FlashObject.menu + '"');                            
		if (FlashObject.name)    document.write(' name="' + FlashObject.name + '"');                            
		document.write(' type="application/x-shockwave-flash" pluginspage="'+ pluginspageURL +'"></embed>');
		document.write('</object>');
	}else{
			document.write(FlashObject.noPlugin);
	}
}

function staffwin(){
staff = window.open('/recruit/staff/index.html','staff','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=600,height=680');
}

function interviewwin(){
recruiting = window.open('/company/recruit/interview/index.html','recruiting','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=620,height=590');
}