<?
include "config.inc.php";
include "class/ad.class.php";
	$tid = $_GET[tid];
	$aid = $_GET[aid];
$action=$_GET[action];
$ad=new Ad();
switch($action){
	case "visit":
	$ad->visit($aid);
	break;
	default:
	$ads = $ad->showAd($aid,$tid);
	if($ads>""){
	$ads=str_replace("\r\n","",addslashes($ads));
    echo "document.write(\"$ads\");";
	}
}
?>