// JavaScript Document

var swf;

if (swf == undefined) {
	swf = function (s, w, h, id) {
		this.initswf(s, w, h, id);
	};
}

swf.prototype.initswf = function(s, w, h, id){
	try{
		this.parameters.clear();
		this.swfSrc = s;
		this.swfWidth = w;
		this.swfHeight = h;
		this.swfID = id;
		this.html = "";
	}catch(e){
		
	}
}

swf.prototype.create = function(docObj, createObj){
	var object = document.getElementById(docObj);
	if(createObj == null){ createObj = true; }
	if(object == null || object == undefined){
		object = document.createElement("SPAN");
		object.id = docObj;
		document.body.appendChild(object);
	}
	this.html = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="'+ this.swfWidth +'" HEIGHT="'+ this.swfHeight +'" ID="obj' + this.swfID + '" NAME="obj' + this.swfID + '">';
	this.html += this.addParam("movie", this.swfSrc + ".swf", "param");
	this.html += this.addParam("quality", "high", "param");
	
	for(i = 0; i < this.parameters.params.length; i++){
		this.html += this.addParam(this.parameters.params[i][0], this.parameters.params[i][1], "param");
	}
	
	this.html += '<EMBED TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" NAME="' + this.swfID + '" ';
	this.html += this.addParam("src", this.swfSrc + ".swf", "embed");
	this.html += this.addParam("quality", "high", "embed");
	
	for(i = 0; i < this.parameters.params.length; i++){
		this.html += this.addParam(this.parameters.params[i][0], this.parameters.params[i][1], "embed");
	}
	
	this.html += 'WIDTH="'+ this.swfWidth +'" HEIGHT="'+ this.swfHeight +'"></EMBED></OBJECT>';
	if(createObj == true) object.innerHTML = this.html;
}

swf.prototype.addParam = function(name, value, paramOrEmbed){
	if(paramOrEmbed == "param"){
		return '<PARAM NAME="' + name + '" VALUE="' + value + '">\n';
	}else{
		return name + '="' + value + '" ';
	}
}

swf.prototype.parameters = {};
swf.prototype.parameters.params = new Array();

swf.prototype.parameters.clear = function(){
	this.params = new Array();
}

swf.prototype.parameters.add = function(name, value){
	this.params[this.params.length] = new Array(name, value);
}
	
swf.prototype.parameters.update = function(name, newvalue){
	for(i = 0; i < this.params.length; i++){
		var index = -1;
		if(this.params[i][0] == name){
			this.params[i][1] = newvalue;
		}
	}
}
	
swf.prototype.parameters.remove = function(name){
	var index = -1;
	for(i = 0; i < this.params.length; i++){
		if(this.params[i][0] == name){
			index = i;
		}
	}
	this.params.splice(index, 1);
}

function GetDateTime(){
	var dayName = new Array("Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi","Pazar");
	var date = new Date();
	var day = date.getDate();
	var month = date.getMonth()+1;
	var year = date.getYear();
	if (day < 10) day = "0" + day;
	if (month < 10) month = "0" + month;
	
	var today = day + "." + month + "." + year + " "+ dayName[date.getDay() - 1] +"";
	var hou = date.getHours();
	var min = date.getMinutes();
	var sec = date.getSeconds();
	if (hou < 10) hou = "0" + hou;
	if (min < 10) min = "0" + min;
	if (sec < 10) sec = "0" + sec;
	var result = today + " " + hou + ":" + min + ":" + sec;
	return result;
	}

function domID(id){
	if(id != "undefined" || id != "" || id != null){
		return document.getElementById(id);
	}else{
		return null;
	}
	}

function formToMail(frm){
	tbl = "<table width='100%' border='1' bordercolor='#d5d5d5' bgcolor='#f5f5f5' cellpadding='5'>";
	tbl += "<tr><td width='120' style='font-weight:bold;'>Tarih</td><td>"+GetDateTime()+"</td></tr>";
	for(i=0; i < frm.elements.length; i++){
		key = frm.elements[i].id || frm.elements[i].name;
		if(frm.elements[i].value != ""){ val = (frm.elements[i].value)?frm.elements[i].value : frm.elements[i].options[frm.elements[i].selectedIndex].value; }else{ val = ""; }
		if(key != "gonder" && key != "islem" && key != "htmlcode" && key.substring(key.length - 1, key.length) != "*"){ tbl += "<tr><td width='120' style='text-transform:capitalize; font-weight:bold;'>"+key.replace("g_", "").replace("_", " ")+"</td><td>"+val+"</td></tr>"; }
	}
	tbl += "</table>";
	var htmlCode = document.createElement("INPUT");
	htmlCode.type = "text";
	htmlCode.style.width = 150;
	htmlCode.id = "htmlcode";
	htmlCode.name = "htmlcode";
	if(domID("htmlcode") == undefined || domID("htmlcode") == null){ frm.appendChild(htmlCode); }
	domID("htmlcode").value = tbl;
	return true;
	}

