//document.write('<'+'script src="../js/telemail.js"'+'></'+'script'+'>')
/* ****************************************************
/*  Telemail JavaScript framework, version 1.0.0.0
 *  Copyright(C) Frompage.Co.,Ltd. All Rights Reserved.
 *
**************************************************** */

function telemail(){

	var codes = null;
	var count = 0;
	
	
	this.windowWidth = 640;
	this.windowHeight = 620;
	this.url = "https://telemail.jp/";
	this.key_baitai =  "btc";
	this.key_code = "srn";
	this.key_backUrl = "url";
	this.key_desCd = "des";	
	this.key_tagCd = "tag";
	this.key_grpCd = "gsn";	
	
	this.baitaiCd="";
	this.backUrl="";
	this.design="";
	this.tag="";	
	this.gsn="";
	
	this.push = function(seikyucode){
		if (codes ==  null){
			codes = new Array();
		}
		codes.push(seikyucode);
		count++;
		return count;
	};
	
	this.show = function(){
		var query = "";
		if( (this.baitaiCd != undefined) && (this.baitaiCd != "")){
			query += this.key_baitai + "=" + this.baitaiCd;
		}
		
		if( (this.backUrl != undefined) && (this.backUrl != "")){
			if ( query != "") { query += "&"; }
			query += this.key_backUrl + "=" + this.backUrl;
		}
		
		if( (this.design != undefined) && (this.design != "")){
			if ( query != "") { query += "&"; }
			query += this.key_desCd + "=" + this.design;
		}
		
		if( (this.tag != undefined) && (this.tag != "")){
			if ( query != "") { query += "&"; }
			query += this.key_tagCd + "=" + this.tag;
		}
		
		if( (this.gsn != undefined) && (this.gsn != "")){
			if ( query != "") { query += "&"; }
			query += this.key_grpCd + "=" + this.gsn;
		}
		
		if (count > 0){
			if ( query != "") { query += "&"; }
			query += this.key_code + "=" + codes.join(",");
		}
		
		var url = this.url;
		if ( query != "" ){ url += "?" + query;}
		
		newwin = parent.window.open(url, "_blank", "alwaysRaised=yes,menubar=no,resizable=yes,status=yes,scrollbars=yes,width="+this.windowWidth+",height="+this.windowHeight);
		if(newwin){
			newwin.focus();
			return;
		}
		else return;

	};
}

function funTeleWindow(baitaicd,seikyucd,url){
	var obj = new telemail();
	obj.push(seikyucd);
	obj.baitaiCd = baitaicd;
	obj.backUrl = url;	
	return obj.show();
}

