function addFlash(fPath,fWidth,fHeight,fAlt) {
	document.write('<!--[if IE]>');
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+fWidth+'" height="'+fHeight+'">');
	document.write('<param name="movie" value="'+fPath+'" />');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write(fAlt);
	document.write('</object>');
	document.write('<![endif]-->');
	document.write('<!--[if !IE]> <--> ');
	document.write('<object type="application/x-shockwave-flash" data="'+fPath+'" width="'+fWidth+'" height="'+fHeight+'">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write(fAlt);
	document.write('</object>');
	document.write('<!--> <![endif]-->');	
}

function winPop(sPicURL,pagetitle) {
	popWindow = window.open('winpop.php?'+sPicURL+'&'+pagetitle,'report','status=no, menubar=no, scrollbars=no, width=640, height=480');
}
function winPopVH1sendtoafriend(theUrl) {
	popWindow = window.open(theUrl,'report','status=no, menubar=no, scrollbars=no, width=475, height=432');
}
function winPopLegal(pagetitle,producer) {
	popWindow = window.open('legalpop.php?title='+pagetitle+'&producer='+producer,'report','status=no, menubar=no, scrollbars=no, width=640, height=480');
}

function goto_URL(object) {
	window.location.href = 'online.php?gid='+object.options[object.selectedIndex].value;
}

function popGame(folderName,pgid) 
{
	window.open('pregamead.php?fname='+folderName,'mywindow','status=no,toolbar=no,scrollbar=no,resizeable=no,width=640, height=480'); 
	location.replace('online.php?pgid='+pgid);
}

function bLink(name,offering,installer,dAffiliate) {
	var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) 
        	return 'http://b.trymedia.com/b/bigfishgames/'+offering+'/'+dAffiliate+'/'+installer;
    }
    else
    {
        begin += 2;
    }
    
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return 'http://b.trymedia.com/b/bigfishgames/'+offering+'/'+unescape(dc.substring(begin + prefix.length, end))+'/'+installer;
}

function dLink(gameID,offering,installer,dAffiliate,siteID) {
	var dc = document.cookie;
    var prefix = "src=";
    var begin = dc.indexOf("; " + prefix);
    
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) 
        	return 'http://d.trymedia.com/d/bigfishgames/'+offering+'/'+dAffiliate+'/'+installer+'.exe';
        	//return 'http://download1.bigfishgames.com/_download.php?gid='+gameID+'&affiliate='+dAffiliate+'&sid='+siteID+'&offering='+offering+'&installer='+installer;
    }
    else
    {
        begin += 2;
    }
    
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return 'http://d.trymedia.com/d/bigfishgames/'+offering+'/'+unescape(dc.substring(begin + prefix.length, end))+'/'+installer+'.exe';
    //return 'http://download1.bigfishgames.com/_download.php?gid='+gameID+'&affiliate='+unescape(dc.substring(begin + prefix.length, end))+'&sid='+siteID+'&offering='+offering+'&installer='+installer;
}