//ヘッド男
function myDrawFunction_head()
{
	//(jg1)ヘッド
	jg1.clear();
	YAHOO.util.Dom.setX(myDiv1,myPos_x) ;	
	YAHOO.util.Dom.setY(myDiv1,myPos_y) ; 

	jg1.setColor("yellow");//左耳
	myLear_width	= myHead_width * myLear_width_per;
	myLear_height	= myLear_width * myLear_height_per;
	myLear_x	= myHead_x - myLear_width / 2;
	myLear_y	= myHead_y + myHead_height / 2 - myLear_height / 4;
	jg1.fillEllipse(myLear_x, myLear_y, myLear_width, myLear_height);

	jg1.setColor("gray");
	jg1.setStroke(1);
	jg1.drawEllipse(myLear_x, myLear_y, myLear_width, myLear_height);

	jg1.setColor("yellow");//右耳
	myRear_width	= myHead_width * myRear_width_per;
	myRear_height	= myLear_width * myRear_height_per;
	myRear_x	= myHead_x + myHead_width - myRear_width / 2;
	myRear_y	= myHead_y + myHead_height / 2 - myRear_height / 4;
	jg1.fillEllipse(myRear_x, myRear_y, myRear_width, myRear_height);

	jg1.setColor("gray");
	jg1.setStroke(1);
	jg1.drawEllipse(myRear_x, myRear_y, myRear_width, myRear_height);

	jg1.setColor("yellow");//顔
	jg1.fillEllipse(myHead_x, myHead_y, myHead_width, myHead_height);

	jg1.setColor("black") //髪上
	jg1.fillArc(myHead_x, myHead_y, myHead_width, myHead_height, 30.0 , 180.0 - 30); // 

	jg1.setColor("yellow") //髪左
	jg1.fillArc(myHead_x, myHead_y, myHead_width, myHead_height, 180.0 - 30 , 180.0 + 30);

	jg1.setColor("yellow")  //髪右
	jg1.fillArc(myHead_x, myHead_y, myHead_width, myHead_height, 330.0 , 30.0);

	jg1.setColor("yellow")  //顔面
	var myL1x	= myHead_x + myHead_width / 2 + myHead_width  / 2 * Math.cos(150 * (Math.PI / 180)); 
	var myL1y	= myHead_y + myHead_height/ 2 - myHead_height / 2 * Math.sin(150 * (Math.PI / 180)); 
	var myR1x	= myHead_x + myHead_width / 2 + myHead_width  / 2 * Math.cos( 30 * (Math.PI / 180)); 
	var myR1y	= myHead_y + myHead_height/ 2 - myHead_height / 2 * Math.sin( 30 * (Math.PI / 180)); 
	var myL2x	= myHead_x + myHead_width / 2 + myHead_width  / 2 * Math.cos(210 * (Math.PI / 180)); 
	var myL2y	= myHead_y + myHead_height/ 2 - myHead_height / 2 * Math.sin(210 * (Math.PI / 180)); 
	var myR2x	= myHead_x + myHead_width / 2 + myHead_width  / 2 * Math.cos(330 * (Math.PI / 180)); 
	var myR2y	= myHead_y + myHead_height/ 2 - myHead_height / 2 * Math.sin(330 * (Math.PI / 180)); 
	jg1.fillRect(myL1x,myL1y,myR1x - myL1x,myR2y - myR1y);

	//(jg1)輪郭
	jg1.setColor("gray");
	jg1.setStroke(1); 
	jg1.drawEllipse(myHead_x, myHead_y, myHead_width, myHead_height);

	//(jg1)髪３本
	if (my_Demo_mode == true ) {
		if (my_Bmode_hair == 0) {
			my_ransu_hair = parseInt(Math.random()*10); 
		}
		if (my_ransu_hair % 4 == 0) { 
			myHair_kakudo1	= 60;
			myHair_kakudo2	= 90;
			myHair_kakudo3	= 120;
		}
		else if (my_ransu_hair % 3 == 0) {
			myHair_kakudo1	= 30;
			myHair_kakudo2	= 60;
			myHair_kakudo3	= 90;
		}
		else if (my_ransu_hair % 5 == 0) {
			myHair_kakudo1	= 12;
			myHair_kakudo2	= 30;
			myHair_kakudo3	= 60;
		}
		else {
			myHair_kakudo1	= 120;
			myHair_kakudo2	= 145;
			myHair_kakudo3	= 170;
		}
	}
	jg1.setColor("black");
	jg1.setStroke(myHead_height / 60); 
	myHair1_x1	= myHead_x + myHead_width / 2;
	myHair1_y1	= myHead_y;
	myHair1_x2	= myHair1_x1 + myHair_height * Math.cos(myHair_kakudo1 * (Math.PI / 180));
	myHair1_y2	= myHair1_y1 - myHair_height * Math.sin(myHair_kakudo1 * (Math.PI / 180));
	jg1.drawLine(myHair1_x1, myHair1_y1, myHair1_x2 , myHair1_y2);

	jg1.setColor("black");
	jg1.setStroke(myHead_height / 60); 
	myHair1_x1	= myHead_x + myHead_width / 2;
	myHair1_y1	= myHead_y;
	myHair1_x2	= myHair1_x1 + myHair_height * Math.cos(myHair_kakudo2 * (Math.PI / 180));
	myHair1_y2	= myHair1_y1 - myHair_height * Math.sin(myHair_kakudo2 * (Math.PI / 180));
	jg1.drawLine(myHair1_x1, myHair1_y1, myHair1_x2 , myHair1_y2);

	jg1.setColor("black");
	jg1.setStroke(myHead_height / 60); 
	myHair1_x1	= myHead_x + myHead_width / 2;
	myHair1_y1	= myHead_y;
	myHair1_x2	= myHair1_x1 + myHair_height * Math.cos(myHair_kakudo3 * (Math.PI / 180));
	myHair1_y2	= myHair1_y1 - myHair_height * Math.sin(myHair_kakudo3 * (Math.PI / 180));
	jg1.drawLine(myHair1_x1, myHair1_y1, myHair1_x2 , myHair1_y2);
}

//ボディ
function myDrawFunction_body()
{
	//(jg2)ボディー
	jg2.clear();
	YAHOO.util.Dom.setX(myDiv2,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv2,myPos_y) ; 
	jg2.setColor("orange");			// 赤
	myBody_x		= myHead_x + ((myHead_width - myBody_width) / 2);
	myBody_y		= myHead_y + myHead_height;
	jg2.fillRect(myBody_x, myBody_y, myBody_width, myBody_height);

	//(jg2)半ズボン
	jg2.setColor("#229EDE");
	myPantu_width1	= myBody_width;
	myPantu_height1	= myBody_height / 4;
	myPantu_x1	= myBody_x;
	myPantu_y1	= myBody_y + myBody_height - myPantu_height1 + 1;
	jg2.fillRect(myPantu_x1, myPantu_y1, myPantu_width1, myPantu_height1);
}

//目、瞳、眉
function myDrawFunction_eye()
{
	//目
	myEye_height_open	= myHead_width * myEye_height_per;
	myEye_width		= myHead_width * myEye_width_per;
	myHitomi_height		= myEye_height_open * myHitomi_height_per;
	myHitomi_width		= myEye_width * myHitomi_width_per;

	//(jg3)左目
	jg3.clear();
	YAHOO.util.Dom.setX(myDiv3,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv3,myPos_y) ; 
	jg3.setColor("white");
	myLeye_width		= myEye_width;
	myLeye_height		= myEye_height_open;
	myLeye_x		= myHead_x + (myHead_width / 4) - (myLeye_width / 2);
	myLeye_y		= myHead_y + myHead_height / 2;
	jg3.fillEllipse(myLeye_x, myLeye_y, myLeye_width, myLeye_height);

	jg3.setColor("black");
	jg3.drawEllipse(myLeye_x, myLeye_y, myLeye_width, myLeye_height);

	//(jg3a)左瞳
	jg3a.clear();
	YAHOO.util.Dom.setX(myDiv3a,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv3a,myPos_y) ; 
	jg3a.setColor("black");

	if (my_Demo_mode == true ) {
		if (my_Bmode_eye == 0) {
			my_ransu_eye = parseInt(Math.random()*10); 
		}
		if (my_ransu_eye % 4 == 0) { 			//偶数
			myLhitomi_x1	= myLeye_x;
			myLhitomi_y1	= myLeye_y + myLeye_height / 2;
			myLhitomi_x2	= myLeye_x + myLeye_width;
			myLhitomi_y2	= myLeye_y + myLeye_height / 2;
			jg3a.drawLine(myLhitomi_x1, myLhitomi_y1, myLhitomi_x2, myLhitomi_y2); //クローズ
		}
		else {
			myLhitomi_width		= myHitomi_width;
			myLhitomi_height	= myHitomi_height;
			myLhitomi_x		= myLeye_x + myLeye_width / 2 - myLhitomi_width / 2;
			myLhitomi_y		= myLeye_y + myLeye_height / 2 - myLhitomi_height / 2;
			jg3a.fillEllipse(myLhitomi_x, myLhitomi_y, myLhitomi_width, myLhitomi_height);//オープン
		}
	}


	//(jg3b)左眉
	jg3b.clear();
	YAHOO.util.Dom.setX(myDiv3b,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv3b,myPos_y) ; 
	jg3b.setColor("black");
	jg3b.setStroke(myHead_height / 20);
	myLBraw_x1	= myLeye_x + myLeye_width - 2;
	myLBraw_y1	= myLeye_y - myLeye_height;

	if (my_Demo_mode == true ) {
		if (my_Bmode_braw == 0) {
			my_ransu_braw = parseInt(Math.random()*10); 
		}
	}

	if (my_ransu_braw % 4 == 0) { //上
		myLBraw_x2	= myLBraw_x1 - myLeye_width * Math.cos(5 * (Math.PI / 180)); 
		myLBraw_y2	= myLBraw_y1 - myLeye_width * Math.sin(5 * (Math.PI / 180));
	}
	else if (my_ransu_braw % 5 == 0) { //下
		myLBraw_x2	= myLBraw_x1 - myLeye_width * Math.cos(-5 * (Math.PI / 180)); 
		myLBraw_y2	= myLBraw_y1 - myLeye_width * Math.sin(-5 * (Math.PI / 180));
	}
	else { //中
		myLBraw_x2	= myLBraw_x1 - myLeye_width * Math.cos(0 * (Math.PI / 180)); 
		myLBraw_y2	= myLBraw_y1 - myLeye_width * Math.sin(0 * (Math.PI / 180));
	}

	jg3b.drawLine(myLBraw_x1,myLBraw_y1,myLBraw_x2,myLBraw_y2);

	//(jg4)右目
	jg4.clear();
	YAHOO.util.Dom.setX(myDiv4,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv4,myPos_y) ; 
	jg4.setColor("white");
	myReye_width		= myEye_width;
	myReye_height		= myEye_height_open;
	myReye_x		= myHead_x + (myHead_width * 3 / 4) - (myReye_width / 2);
	myReye_y		= myHead_y + myHead_height / 2;
	jg4.fillEllipse(myReye_x, myReye_y, myReye_width, myReye_height);

	jg4.setColor("black");
	jg4.drawEllipse(myReye_x, myReye_y, myReye_width, myReye_height);

	//(jg4a)右瞳
	jg4a.clear();
	YAHOO.util.Dom.setX(myDiv4a,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv4a,myPos_y) ; 
	jg4a.setColor("black");

	if (my_Demo_mode == true) {
		if (my_ransu_eye % 4 == 0) { 
			myRhitomi_x1	= myReye_x;
			myRhitomi_y1	= myReye_y + myReye_height / 2;
			myRhitomi_x2	= myReye_x + myReye_width;
			myRhitomi_y2	= myReye_y + myReye_height / 2;
			jg4a.drawLine(myRhitomi_x1, myRhitomi_y1, myRhitomi_x2, myRhitomi_y2);
		}
		else {
			myRhitomi_width		= myHitomi_width;
			myRhitomi_height	= myHitomi_height;
			myRhitomi_x		= myReye_x + myReye_width / 2 - myRhitomi_width / 2;
			myRhitomi_y		= myReye_y + myReye_height / 2 - myRhitomi_height / 2;
			jg4a.fillEllipse(myRhitomi_x, myRhitomi_y, myRhitomi_width, myRhitomi_height);
		}
	}
	//(jg4b)右眉
	jg4b.clear();
	YAHOO.util.Dom.setX(myDiv4b,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv4b,myPos_y) ; 
	jg4b.setColor("black");
	jg4b.setStroke(myHead_height / 20); 
	myRBraw_x1	= myReye_x; 
	myRBraw_y1	= myReye_y - myReye_height;


	if (my_ransu_braw % 4 == 0) { 
		myRBraw_x2	= myRBraw_x1 + myReye_width * Math.cos(5 * (Math.PI / 180));
		myRBraw_y2	= myRBraw_y1 - myReye_width * Math.sin(5 * (Math.PI / 180));
	}
	else if (my_ransu_braw % 5 == 0) { 
		myRBraw_x2	= myRBraw_x1 + myReye_width * Math.cos(-5 * (Math.PI / 180));
		myRBraw_y2	= myRBraw_y1 - myReye_width * Math.sin(-5 * (Math.PI / 180));
	}
	else {
		myRBraw_x2	= myRBraw_x1 + myReye_width * Math.cos(0 * (Math.PI / 180));
		myRBraw_y2	= myRBraw_y1 - myReye_width * Math.sin(0 * (Math.PI / 180));
	}


	jg4b.drawLine(myRBraw_x1,myRBraw_y1,myRBraw_x2,myRBraw_y2);
}
//鼻
function myDrawFunction_nose()
{
	//(jg5)鼻
	jg5.clear();
	YAHOO.util.Dom.setX(myDiv5,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv5,myPos_y) ; 
	jg5.setColor("black");
	myNose_width		= myHead_width * myNose_width_per;
	myNose_height		= myNose_width * myNose_height_per;
	myNose_x		= myHead_x + ((myHead_width - myNose_width) / 2);
	myNose_y		= myHead_y + (myHead_height * myNose_y_position);
	jg5.fillArc(myNose_x, myNose_y, myNose_width, myNose_height, 360.0 , 180.0);
}

//口
function myDrawFunction_mouse()
{
	//(jg6)口
	jg6.clear();
	YAHOO.util.Dom.setX(myDiv6,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv6,myPos_y) ; 

	//口
	var myL1x	= myHead_x + myHead_width / 2 + myHead_width  / 2 * Math.cos(-140 * (Math.PI / 180)); 
	var myMouse_L1y	= myHead_y + myHead_height/ 2 - myHead_height / 2 * Math.sin(-140 * (Math.PI / 180)); 
	var myL2x	= myHead_x + myHead_width / 2 + myHead_width  / 2 * Math.cos(-40 * (Math.PI / 180)); 
	var myMouse_L2y	= myHead_y + myHead_height/ 2 - myHead_height / 2 * Math.sin(-40 * (Math.PI / 180)); 
	myMouse_width	= (myL2x - myL1x) * myMouse_width_per;
	var myMouse_yohaku	= (myL2x - myL1x) * (1 - myMouse_width_per) / 2;
	myMouse_L1x	= myL1x + myMouse_yohaku;
	myMouse_L2x	= myMouse_L1x + myMouse_width;
	myMouse_height	= myMouse_width * myMouse_height_per;

	if (my_Demo_mode == true ) {
		if (my_Bmode_mouse == 0) {
			my_ransu_mouse = parseInt(Math.random()*10); 
		}
	}

	if (my_ransu_mouse >= 8) { //開いた口
		jg6.setColor("white");
		myMouse_x1		= myMouse_L1x;
		myMouse_y1		= myMouse_L1y - myMouse_height / 2;
		jg6.fillEllipse(myMouse_x1, myMouse_y1, myMouse_width, myMouse_height);
		jg6.setColor("black");
		jg6.drawEllipse(myMouse_x1, myMouse_y1, myMouse_width, myMouse_height);

		//左歯
		var myTooth_L1x	= myMouse_x1 + myMouse_width / 2 + myMouse_width / 2 * Math.cos(105 * (Math.PI / 180));
		var myTooth_L1y	= myMouse_y1 + myMouse_height / 2 - myMouse_height / 2 * Math.sin(105 * (Math.PI / 180)); 
		jg6.setColor("black");
		jg6.drawLine(myTooth_L1x, myTooth_L1y, myTooth_L1x, myMouse_y1 + myMouse_height / 2);

		var myTooth_L2x	= myMouse_x1 + myMouse_width / 2 + myMouse_width / 2 * Math.cos(90 * (Math.PI / 180));
		var myTooth_L2y	= myMouse_y1 + myMouse_height / 2 - myMouse_height / 2 * Math.sin(90 * (Math.PI / 180)); 
		jg6.setColor("black");
		jg6.drawLine(myTooth_L2x, myTooth_L2y, myTooth_L2x, myMouse_y1 + myMouse_height / 2);

		jg6.setColor("black");
		jg6.drawLine(myTooth_L1x, myMouse_y1 + myMouse_height / 2, myTooth_L2x, myMouse_y1 + myMouse_height / 2);

		//左歯２
		var myTooth_L1x	= myMouse_x1 + myMouse_width / 2 + myMouse_width / 2 * Math.cos(105 * (Math.PI / 180));
		var myTooth_L1y	= myMouse_y1 + myMouse_height / 2 - myMouse_height / 2 * Math.sin(105 * (Math.PI / 180)); 
		jg6.setColor("black");
		jg6.drawLine(myTooth_L1x, myTooth_L1y, myTooth_L1x, myMouse_y1 + myMouse_height / 2);

		var myTooth_L2x	= myMouse_x1 + myMouse_width / 2 + myMouse_width / 2 * Math.cos(120 * (Math.PI / 180));
		var myTooth_L2y	= myMouse_y1 + myMouse_height / 2 - myMouse_height / 2 * Math.sin(120 * (Math.PI / 180)); 
		jg6.setColor("black");
		jg6.drawLine(myTooth_L2x, myTooth_L2y, myTooth_L2x, myMouse_y1 + myMouse_height / 2);

		jg6.setColor("black");
		jg6.drawLine(myTooth_L1x, myMouse_y1 + myMouse_height / 2, myTooth_L2x, myMouse_y1 + myMouse_height / 2);

		//右歯１
		var myTooth_L1x	= myMouse_x1 + myMouse_width / 2 + myMouse_width / 2 * Math.cos(75 * (Math.PI / 180));
		var myTooth_L1y	= myMouse_y1 + myMouse_height / 2 - myMouse_height / 2 * Math.sin(75 * (Math.PI / 180)); 
		jg6.setColor("black");
		jg6.drawLine(myTooth_L1x, myTooth_L1y, myTooth_L1x, myMouse_y1 + myMouse_height / 2);

		var myTooth_L2x	= myMouse_x1 + myMouse_width / 2 + myMouse_width / 2 * Math.cos(90 * (Math.PI / 180));
		var myTooth_L2y	= myMouse_y1 + myMouse_height / 2 - myMouse_height / 2 * Math.sin(90 * (Math.PI / 180)); 
		jg6.setColor("black");
		jg6.drawLine(myTooth_L2x, myTooth_L2y, myTooth_L2x, myMouse_y1 + myMouse_height / 2);

		jg6.setColor("black");
		jg6.drawLine(myTooth_L1x, myMouse_y1 + myMouse_height / 2, myTooth_L2x, myMouse_y1 + myMouse_height / 2);

		//右歯２
		var myTooth_L1x	= myMouse_x1 + myMouse_width / 2 + myMouse_width / 2 * Math.cos(60 * (Math.PI / 180));
		var myTooth_L1y	= myMouse_y1 + myMouse_height / 2 - myMouse_height / 2 * Math.sin(60 * (Math.PI / 180)); 
		jg6.setColor("black");
		jg6.drawLine(myTooth_L1x, myTooth_L1y, myTooth_L1x, myMouse_y1 + myMouse_height / 2);

		var myTooth_L2x	= myMouse_x1 + myMouse_width / 2 + myMouse_width / 2 * Math.cos(75 * (Math.PI / 180));
		var myTooth_L2y	= myMouse_y1 + myMouse_height / 2 - myMouse_height / 2 * Math.sin(75 * (Math.PI / 180)); 
		jg6.setColor("black");
		jg6.drawLine(myTooth_L2x, myTooth_L2y, myTooth_L2x, myMouse_y1 + myMouse_height / 2);

		jg6.setColor("black");
		jg6.drawLine(myTooth_L1x, myMouse_y1 + myMouse_height / 2, myTooth_L2x, myMouse_y1 + myMouse_height / 2);
	}
	else if (my_ransu_mouse >= 6) { //スマイル
		jg6.setColor("yellow");
		myMouse_x1	= myMouse_L1x;
		myMouse_y1	= myMouse_L1y - myMouse_height / 2 - myMouse_height / 3;
		jg6.fillEllipse(myMouse_x1, myMouse_y1, myMouse_width, myMouse_height);
		jg6.setColor("black");
		jg6.drawEllipse(myMouse_x1, myMouse_y1, myMouse_width, myMouse_height);
		jg6.setColor("yellow");
		jg6.fillArc(myMouse_x1, myMouse_y1, myMouse_width, myMouse_height, 180.0, 360.0);

		jg6.fillRect(myMouse_x1, myMouse_y1, myMouse_width, myMouse_height / 2);
	}
	else if (my_ransu_mouse >= 5) { //怒り
		jg6.setStroke(1);
		jg6.setColor("black");
		myMouse_A1x	= myMouse_L1x + myMouse_width / 2;
		myMouse_A1y	= myMouse_L1y;
		myMouse_A2x	= myMouse_A1x - myMouse_width / 2 * Math.cos(30 * (Math.PI / 180)); 
		myMouse_A2y	= myMouse_A1y + myMouse_height / 2 * Math.sin(30 * (Math.PI / 180)); 
		jg6.drawLine(myMouse_A1x, myMouse_A1y, myMouse_A2x, myMouse_A2y);

		myMouse_A2x	= myMouse_A1x + myMouse_width / 2 * Math.cos(30 * (Math.PI / 180)); 
		myMouse_A2y	= myMouse_A1y + myMouse_height / 2 * Math.sin(30 * (Math.PI / 180)); 
		jg6.drawLine(myMouse_A1x, myMouse_A1y, myMouse_A2x, myMouse_A2y);
	}
	else { //一文字
		jg6.setColor("black");
		jg6.drawLine(myMouse_L1x, myMouse_L1y, myMouse_L2x, myMouse_L2y);
	}





}
//左肩、左腕、左手
function myDrawFunction_Larm()
{
	myCount7++;
	if (myCount7 > 4){myCount7 = 1;}

	//左肩
	//myDrawFunction_Lkata(x_1,x_2,x_3,x_4,x_5,x_6);
	jg7.clear();
	YAHOO.util.Dom.setX(myDiv7,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv7,myPos_y) ; 
	jg7.setColor("black");
	myLkata_width		= myBody_width / 3;
	myLkata_height		= myLkata_width * 2 / 3;
	myLkata_x		= myBody_x - (myLkata_width / 2);
	myLkata_y		= myBody_y;
	jg7.fillArc(myLkata_x, myLkata_y, myLkata_width, myLkata_height, 90.0, 270.0);

	//(jg7a)左腕
	jg7a.clear();
	YAHOO.util.Dom.setX(myDiv7a,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv7a,myPos_y) ; 
	jg7a.setColor("black");

	if (my_Demo_mode == true ) {
		if (my_Bmode_Larm == 0) {
			my_ransu_Larm = parseInt(Math.random()*10); 
		}
	}

	if (my_ransu_Larm % 4 == 0) { //上
		myLarm_width		= myLkata_width / 2;
		myLarm_height		= (myBody_height  / 2)  * 1 + myLkata_height * 0 / 3;
		myLarm_x		= myLkata_x;
		myLarm_y		= myLkata_y - myLarm_height + myLkata_height / 2 ;
		jg7a.fillRect(myLarm_x, myLarm_y, myLarm_width, myLarm_height);
	}
	else if (my_ransu_Larm % 5 == 0) { //中
		myLarm_width		= myLkata_width / 2;
		myLarm_height		= (myBody_height  / 2)  * 1 + myLkata_height * 0 / 3;
		myLarm_x		= myBody_x;
		myLarm_y		= myLkata_y;
		jg7a.fillRect(myLarm_x, myLarm_y, myLarm_height, myLarm_width);
	}
	else if (my_ransu_Larm % 9 == 0) { //外
		myLarm_width		= myLkata_width / 2;
		myLarm_height		= (myBody_height  / 2)  * 1 + myLkata_height * 0 / 3;
		myLarm_x		= myBody_x - myLarm_height;
		myLarm_y		= myLkata_y;
		jg7a.fillRect(myLarm_x, myLarm_y, myLarm_height, myLarm_width);
	}
	else {	//下
		myLarm_width		= myLkata_width / 2;
		myLarm_height		= (myBody_height  / 2) * 1;
		myLarm_x		= myLkata_x;
		myLarm_y		= myLkata_y + (myLkata_height / 2);
		jg7a.fillRect(myLarm_x, myLarm_y, myLarm_width, myLarm_height);
	}

	//(jg7b)左手
	jg7b.clear();
	YAHOO.util.Dom.setX(myDiv7b,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv7b,myPos_y) ; 
	jg7b.setColor("yellow");
	myLhand_width		= myLarm_width;
	myLhand_height		= myLarm_width;
	if (my_ransu_Larm % 4 == 0) { 
		myLhand_x		= myLarm_x;
		myLhand_y		= myLarm_y - myLhand_height / 2;
		jg7b.fillArc(myLhand_x, myLhand_y, myLhand_width, myLhand_height, 360.0, 180.0);
	}
	else if (my_ransu_Larm % 5 == 0) { 
		myLhand_x		= myLarm_x + myLarm_height - myLhand_width / 2;
		myLhand_y		= myBody_y;
		jg7b.fillArc(myLhand_x, myLhand_y, myLhand_width, myLhand_height, 270.0, 90.0);
	}
	else if (my_ransu_Larm % 9 == 0) { 
		myLhand_x		= myLarm_x - myLhand_width / 2;
		myLhand_y		= myBody_y;
		jg7b.fillArc(myLhand_x, myLhand_y, myLhand_width, myLhand_height, 90.0, 270.0);
	}
	else {
		myLhand_x		= myLarm_x;
		myLhand_y		= myLarm_y + myLarm_height - myLhand_height / 2;
		jg7b.fillArc(myLhand_x, myLhand_y, myLhand_width, myLhand_height, 180.0, 360.0);
	}

	jg7b.setColor("gray");
	jg7b.setStroke(1); 
	jg7b.drawEllipse(myLhand_x, myLhand_y, myLhand_width, myLhand_height);
}

//右肩、右腕、右手
function myDrawFunction_Rarm()
{
	//(jg8)右肩
	jg8.clear();
	YAHOO.util.Dom.setX(myDiv8,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv8,myPos_y) ; 
	jg8.setColor("black");
	myRkata_width		= myBody_width / 3;
	myRkata_height		= myRkata_width * 2 / 3;
	myRkata_x		= myBody_x + myBody_width - myRkata_width / 2;
	myRkata_y		= myBody_y;
	jg8.fillArc(myRkata_x, myRkata_y, myRkata_width, myRkata_height, 270.0, 90.0);
	//jg8.fillEllipse(myRkata_x, myRkata_y, myRkata_width, myRkata_height);

	//(jg8a)右腕
	jg8a.clear();
	YAHOO.util.Dom.setX(myDiv8a,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv8a,myPos_y) ; 
	if (my_Demo_mode == true ) {
		if (my_Bmode_Rarm == 0) {
			my_ransu_Rarm = parseInt(Math.random()*10); 
		}
	}
	
	if (my_ransu_Rarm % 4 == 0) { //上
		myRarm_width		= myRkata_width / 2;
		myRarm_height		= (myBody_height  / 2)  * 1 + myRkata_height * 0/ 3;
		myRarm_x		= myRkata_x + myRkata_width / 2;
		myRarm_y		= myRkata_y - myRarm_height + myRkata_height / 2 ;
		jg8a.fillRect(myRarm_x, myRarm_y, myRarm_width, myRarm_height);
	}
	else if (my_ransu_Rarm % 5 == 0) { //中
		myRarm_width		= myRkata_width / 2;
		myRarm_height		= (myBody_height  / 2)  * 1 + myRkata_height * 0 / 3;
		myRarm_x		= myBody_x + myBody_width - myRarm_height;
		myRarm_y		= myRkata_y;
		jg8a.fillRect(myRarm_x, myRarm_y, myRarm_height, myRarm_width);
	}
	else if (my_ransu_Rarm % 9 == 0) { //外
		myRarm_width		= myRkata_width / 2;
		myRarm_height		= (myBody_height  / 2)  * 1 + myRkata_height * 0 / 3;
		myRarm_x		= myBody_x + myBody_width;
		myRarm_y		= myRkata_y;
		jg8a.fillRect(myRarm_x, myRarm_y, myRarm_height, myRarm_width);
	}
	else {	//下
		myRarm_width		= myRkata_width / 2;
		myRarm_height		= (myBody_height  / 2)  * 1;
		myRarm_x		= myRkata_x + myRkata_width / 2;
		myRarm_y		= myRkata_y + (myRkata_height / 2);
		jg8a.fillRect(myRarm_x, myRarm_y, myRarm_width, myRarm_height);
	}

	//(jg8b)右手
	jg8b.clear();
	YAHOO.util.Dom.setX(myDiv8b,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv8b,myPos_y) ; 
	jg8b.setColor("yellow");
	myRhand_width		= myRarm_width;
	myRhand_height		= myRarm_width;
	if (my_ransu_Rarm % 4 == 0) { 
		myRhand_x		= myRarm_x;
		myRhand_y		= myRarm_y - myRhand_height / 2;
		jg8b.fillArc(myRhand_x, myRhand_y, myRhand_width, myRhand_height, 360.0, 180.0);
	}
	else if (my_ransu_Rarm % 5 == 0) { 
		myRhand_x		= myRarm_x - myRhand_width / 2;
		myRhand_y		= myBody_y;
		jg8b.fillArc(myRhand_x, myRhand_y, myRhand_width, myRhand_height, 90.0, 270.0);
	}
	else if (my_ransu_Rarm % 9 == 0) { 
		myRhand_x		= myRarm_x + myRarm_height - myRhand_width / 2;
		myRhand_y		= myBody_y;
		jg8b.fillArc(myRhand_x, myRhand_y, myRhand_width, myRhand_height, 270.0, 90.0);
	}
	else {
		myRhand_x		= myRarm_x;
		myRhand_y		= myRarm_y + myRarm_height - myRhand_height / 2;
		jg8b.fillArc(myRhand_x, myRhand_y, myRhand_width, myRhand_height, 180.0, 360.0);
	}

	jg8b.setColor("gray");
	jg8b.setStroke(1); 
	jg8b.drawEllipse(myRhand_x, myRhand_y, myRhand_width, myRhand_height);
}

//左脚
function myDrawFunction_Lleg()
{
	myLleg_ix++;
	if (myLleg_ix > 10){myLleg_ix = 1;}

	//倍率
	if (my_Demo_mode == true ) {
		var myBairitu 	  = 1;			//パンツ倍率
		var myBairitu_leg = 1 * myLeg_per;	//脚倍率
		if (my_Bmode_Lleg == 0) {
			if (myLleg_ix % 2 != 0) { 
				myBairitu = 1.18;
				myBairitu_leg = myBairitu * myLeg_per;
			}
		}
		else {
			myBairitu = 1.1;
			myBairitu_leg = myBairitu * myLeg_per;
		}
	}
	//(jg9)左半ズボン幅
	myLpantu_width		= (myBody_width * myPantu_per) * myBairitu;

	//(jg9)左脚
	jg9.clear();
	YAHOO.util.Dom.setX(myDiv9,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv9,myPos_y) ; 
	jg9.setColor("black");
	myLleg_width		= (myBody_width / 3) * 0.9 * myBairitu_leg;
	myLleg_height		= (myBody_height / 3.5) * myBairitu;
	myLleg_x		= myBody_x + (myLpantu_width - myLleg_width) / 2;
	myLleg_y		= myBody_y + myBody_height;
	jg9.fillRect(myLleg_x, myLleg_y, myLleg_width, myLleg_height);

	//(jg9)左半ズボン
	jg9.setColor("#229EDE");
	myLpantu_height		= (myLleg_height / 4) * myBairitu;
	myLpantu_x		= myBody_x;
	myLpantu_y		= myBody_y + myBody_height;
	jg9.fillRect(myLpantu_x, myLpantu_y, myLpantu_width, myLpantu_height);

	//(jg11)左足
	jg11.clear();
	YAHOO.util.Dom.setX(myDiv11,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv11,myPos_y) ; 
	jg11.setColor("yellow");
	myLfoot_width		= myLleg_width;
	myLfoot_height		= myLfoot_width / 2;
	myLfoot_x		= myLleg_x;
	myLfoot_y		= myLleg_y + myLleg_height - myLfoot_height / 2;
	jg11.fillArc(myLfoot_x, myLfoot_y, myLfoot_width, myLfoot_height, 180.0, 360.0);

	jg11.setColor("gray");
	jg11.setStroke(1); 
	jg11.drawEllipse(myLfoot_x, myLfoot_y, myLfoot_width, myLfoot_height);
}

//右脚
function myDrawFunction_Rleg()
{
	myRleg_ix++;
	if (myRleg_ix > 10){myRleg_ix = 1;}

	//倍率
	if (my_Demo_mode == true ) {
		var myBairitu 	  = 1;			//パンツ倍率
		var myBairitu_leg = 1 * myLeg_per;	//脚倍率
		if (my_Bmode_Rleg == 0) {
			if (myRleg_ix % 2 == 0) { 
				myBairitu = 1.18;
				myBairitu_leg = myBairitu * myLeg_per;
			}
		}
		else {
			myBairitu = 1.1;
			myBairitu_leg = myBairitu * myLeg_per;
		}
	}
	//右半ズボン幅
	myRpantu_width		= myBody_width * myPantu_per * myBairitu;
	myRpantu_x		= myBody_x + myBody_width - myRpantu_width;

	//(jg10)右脚
	jg10.clear();
	YAHOO.util.Dom.setX(myDiv10,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv10,myPos_y) ; 
	jg10.setColor("black");
	myRleg_width		= (myBody_width / 3) * 0.9 * myBairitu_leg;
	myRleg_height		= (myBody_height / 3.5) * myBairitu;
	myRleg_x		= myRpantu_x + (myRpantu_width - myRleg_width) / 2;
	myRleg_y		= myBody_y + myBody_height;
	jg10.fillRect(myRleg_x, myRleg_y, myRleg_width, myRleg_height);

	//(jg10)右半ズボン
	jg10.setColor("#229EDE");
	myRpantu_height		= myRleg_height / 4;
	myRpantu_y		= myBody_y + myBody_height;
	jg10.fillRect(myRpantu_x, myRleg_y, myRpantu_width + 1, myRpantu_height);

	//(jg12)右足
	jg12.clear();
	YAHOO.util.Dom.setX(myDiv12,myPos_x) ; 
	YAHOO.util.Dom.setY(myDiv12,myPos_y) ; 
	jg12.setColor("yellow");
	myRfoot_width		= myRleg_width;
	myRfoot_height		= myRfoot_width / 2;
	myRfoot_x		= myRleg_x;
	myRfoot_y		= myRleg_y + myRleg_height - myRfoot_height / 2;
	jg12.fillArc(myRfoot_x, myRfoot_y, myRfoot_width, myRfoot_height, 180.0, 360.0);

	jg12.setColor("gray");
	jg12.setStroke(1); 
	jg12.drawEllipse(myRfoot_x, myRfoot_y, myRfoot_width, myRfoot_height);
}


//首
function myDrawFunction_Kubi()
{
	//(jg13)首
	jg13.clear();
	YAHOO.util.Dom.setX(myDiv13,myPos_x); 
	YAHOO.util.Dom.setY(myDiv13,myPos_y); 
	jg13.setColor("yellow");
	myKubi_width		= myBody_width / 4;
	myKubi_height		= myBody_height / 1;
	myKubi_x		= myBody_x + myBody_width / 2 - myKubi_width / 2;
	myKubi_y		= myBody_y - myKubi_height / 2;
	jg13.fillArc(myKubi_x, myKubi_y, myKubi_width, myKubi_height, 180.0, 360.0);
}

//蝶ネクタイ
function myDrawFunction_Necktie()
{
	//(jg14)蝶ネクタイ
	jg14.clear();
	YAHOO.util.Dom.setX(myDiv14,myPos_x); 
	YAHOO.util.Dom.setY(myDiv14,myPos_y); 
	jg14.setColor("blue");
	myNecktie_width	= myBody_width / 3;
	myNecktie_height= myNecktie_width / 2 * 1.2;
	myNecktie_x1	= myBody_x + myBody_width / 2 - myNecktie_width / 2;
	myNecktie_x2	= myBody_x + myBody_width / 2 - myNecktie_width / 2;
	myNecktie_x3	= myBody_x + myBody_width / 2 + myNecktie_width / 2;
	myNecktie_x4	= myBody_x + myBody_width / 2 + myNecktie_width / 2;
	myNecktie_y1	= myBody_y - myNecktie_height * 1 / 7;
	myNecktie_y2	= myNecktie_y1 + myNecktie_height;
	myNecktie_y3	= myNecktie_y1;
	myNecktie_y4	= myNecktie_y1 + myNecktie_height;
	jg14.fillPolygon(new Array(myNecktie_x1,myNecktie_x2,myNecktie_x3,myNecktie_x4),new Array(myNecktie_y1,myNecktie_y2,myNecktie_y3,myNecktie_y4));

	jg14.setColor("gold");
	myNeckC_width	= myNecktie_width / 3;
	myNeckC_height	= myNeckC_width * 1.2;
	myNeckC_x	= myNecktie_x1 + myNecktie_width / 2 - myNeckC_width / 2;
	myNeckC_y	= myNecktie_y3 + myNecktie_height / 2 - myNeckC_height / 2;
	jg14.fillEllipse(myNeckC_x, myNeckC_y, myNeckC_width, myNeckC_height);

}
//曜日
function myDrawFunction_Week(p_no)
{
	switch (p_no) {
	case 1:
	    return("月");break;
	case 2:
	    return("火");break;
	case 3:
	    return("水");break;
	case 4:
	    return("木");break;
	case 5:
	    return("金");break;
	case 6:
	    return("土");break;
	case 0:
	    return("日");break;
	default:
	    return("");break;
	}
}

//せりふ窓


function myDrawFunction_Serifumado()
{
	jg15.clear();
	if (my_Demo_mode == true ) {
		mySerifumado_width_per	= 1.1;
		mySerifumado_height_per	= 0.6;
	}
	if (my_Demo_mode == true ) {
		if (my_Bmode_serifumado == 1) {
			//(jg15)せりふ窓
			YAHOO.util.Dom.setX(myDiv15,myPos_x); 
			YAHOO.util.Dom.setY(myDiv15,myPos_y); 

			mySerifumado_width	= myBase_width * mySerifumado_width_per;
			mySerifumado_height	= myBase_width * mySerifumado_height_per;
			mySerifumado_x1		= myHead_x + myHead_width * 1.15;
			mySerifumado_y1		= myHead_y + myHead_height * 0.15;

			jg15.setColor("white");
			mySerifumado_A1x = mySerifumado_x1 + mySerifumado_width / 2;
			mySerifumado_A1y = mySerifumado_y1 + mySerifumado_height / 2;
			mySerifumado_A2x = mySerifumado_A1x + mySerifumado_width / 2 * Math.cos(190 * (Math.PI / 180)); 
			mySerifumado_A2y = mySerifumado_A1y - mySerifumado_height / 2 * Math.sin(190 * (Math.PI / 180)); 
			mySerifumado_A3x = mySerifumado_A1x + mySerifumado_width / 2 * Math.cos(220 * (Math.PI / 180)); 
			mySerifumado_A3y = mySerifumado_A1y - mySerifumado_height / 2 * Math.sin(220 * (Math.PI / 180)); 
			mySerifumado_A4x = mySerifumado_A1x + mySerifumado_width / 2 * 1.3 * Math.cos(195 * (Math.PI / 180)); 
			mySerifumado_A4y = mySerifumado_A1y - mySerifumado_height / 2 * 1.3 * Math.sin(195 * (Math.PI / 180)); 
			jg15.fillPolygon(new Array(mySerifumado_A1x,mySerifumado_A2x,mySerifumado_A4x,mySerifumado_A3x),new Array(mySerifumado_A1y,mySerifumado_A2y,mySerifumado_A4y,mySerifumado_A3y));

			jg15.setColor("black"); //噴出し線
			jg15.setStroke(1);
			jg15.drawPolygon(new Array(mySerifumado_A1x,mySerifumado_A2x,mySerifumado_A4x,mySerifumado_A3x),new Array(mySerifumado_A1y,mySerifumado_A2y,mySerifumado_A4y,mySerifumado_A3y));

			jg15.setColor("white"); //窓色
			jg15.fillEllipse(mySerifumado_x1, mySerifumado_y1, mySerifumado_width, mySerifumado_height);

			jg15.setColor("black");	//外枠
			jg15.setStroke(1);
			jg15.drawEllipse(mySerifumado_x1, mySerifumado_y1, mySerifumado_width, mySerifumado_height);

			jg15.setColor("white"); //不要な線を消す
			jg15.fillArc(mySerifumado_x1, mySerifumado_y1, mySerifumado_width, mySerifumado_height, 190.0, 220.0);
		}
	}
}

//せりふ
function myDrawFunction_Serifu()
{
	var time = new Date ();
	var secs = time.getSeconds();
	var mins = time.getMinutes();
	var hr = time.getHours();

	var TimeFullYear 	= time.getFullYear();
	var TimeMonth		= time.getMonth() + 1;
	var TimeDate		= time.getDate();
	var TimeDay		= time.getDay();
	var TimeMilliseconds	= time.getMilliseconds();

	myWord_array = new Array(21);
	myWord_array[0] = "今年もよろしくね";
	myWord_array[1] = "陣太郎ドットコム";
	myWord_array[2] = "あーちゃんです";
	myWord_array[3] = "占い新メニュー";
	myWord_array[4] = "あなたの人生劇場";
	myWord_array[5] = "見てね～";
	myWord_array[6] = "今日は" + myDrawFunction_Week(TimeDay) + "曜日";
	myWord_array[7] = "四柱推命学です";
	myWord_array[8] = "丸星ラーメン";
	myWord_array[9] = "大阪の串かつ";
	myWord_array[10] = "占いは陣太郎";
	myWord_array[11] = "今" + hr + "時" + mins + "分よ";
	myWord_array[12] = TimeMonth + "月" + TimeDate + "日だよ";
	myWord_array[13] = "錦市場";
	myWord_array[14] = "豊来飯店";
	myWord_array[15] = "きむち鍋～";
	myWord_array[16] = "炊込みごはん";
	myWord_array[17] = "旦過市場";
	myWord_array[18] = "明大寺外狩自転車";
	myWord_array[19] = "スナックエンドウ";
	myWord_array[20] = "一度の人生";
	myWord_array[21] = "東岡崎シビコ～";
	myWord_array[22] = "御幸本町の鳥一";
	myWord_array[23] = "台湾ラーメン";
	myWord_array[24] = "柿の葉寿司";
	myWord_array[25] = "味噌煮込みうどん";
	myWord_array[26] = "八丁味噌";
	myWord_array[27] = "丸幸ラーメン";
	myWord_array[28] = "点天の餃子～";
	myWord_array[29] = "寿がきや～";
	myWord_array[30] = "味噌カツ～";


	myWord_array2 = new Array(24);
	myWord_array2[0] = "まだ寝ないの？";
	myWord_array2[1] = "あした大丈夫？";
	myWord_array2[2] = "丑三つ時だよ～";
	myWord_array2[3] = "朝刊そろそかな";
	myWord_array2[4] = "もう起きたの？";
	myWord_array2[5] = "早起きだね";
	myWord_array2[6] = "おはよう～";
	myWord_array2[7] = "朝食、食べた？";
	myWord_array2[8] = "遅刻しないように";
	myWord_array2[9] = "今日も頑張ろうね";
	myWord_array2[10] = "頑張ってる？";
	myWord_array2[11] = "もうすぐお昼";
	myWord_array2[12] = "お昼休みだね";
	myWord_array2[13] = "お昼食べた？";
	myWord_array2[14] = "この時間眠いね";
	myWord_array2[15] = "そろそろおやつ";
	myWord_array2[16] = "今日もあと少しね";
	myWord_array2[17] = "今日は残業？";
	myWord_array2[18] = "今日も一日お疲れ様";
	myWord_array2[19] = "ひったくり注意";
	myWord_array2[20] = "ごはん食べた？";
	myWord_array2[21] = "お風呂はいろう？";
	myWord_array2[22] = "一生勉強";
	myWord_array2[23] = "そろそろ寝よう";

	jg16.clear();
	if (my_Demo_mode == true ) {

		if (my_Bmode_serifu == 1) {
			myCount3++;
			if (myCount3 == 1) {
				myCount3a++;
				if (myCount3a <= 5) {
					myWord = myWord_array[myCount3a];
				}
				else {
					my_ransu_serifu = parseInt(Math.random()*13);
					if (my_ransu_serifu > 2) {
						my_ransu_serifu = parseInt(Math.random()*31);
						myWord = myWord_array[my_ransu_serifu];
					}
					else {
						myWord = myWord_array2[hr];
					}
				}
			}
			if (myCount3 >= mySerifu_dispcnt) {
				myCount3 = 0;
			}
			//(jg16)せりふ

			YAHOO.util.Dom.setX(myDiv16,myPos_x); 
			YAHOO.util.Dom.setY(myDiv16,myPos_y); 

			var myWord_px = parseInt(mySerifumado_width / myWord.length * 0.8);

			mySerifu_x	= mySerifumado_x1 + (mySerifumado_width - myWord.length * myWord_px) / 2;
			mySerifu_y	= mySerifumado_y1 + mySerifumado_height / 2 - myWord_px / 2 * mySerifumado_height / mySerifumado_width;

			//jg16.setFont("arial","10px",Font.BOLD); 
			jg16.setFont("arial",myWord_px,Font.PLAIN); 

			jg16.setColor("black"); //
			jg16.drawString(myWord,mySerifu_x, mySerifu_y - 7); 
		}
	}
}

//ボタン
function myDrawFunction_Button()
{
	myCount13++;
	if (myCount13 == 1) {
		if (my_Demo_mode == true ) {
			//if (myBase_width >= myBase_width_max) {
				var myButton_x	= myPos_x0 - 40 * 3 / 2;

				YAHOO.util.Dom.setX(myDiv17,myButton_x); 
				YAHOO.util.Dom.setY(myDiv17,myPos_y0 + myBase_y); 

				var myHtml = "<input type=\"button\" value=\"Stop\" onClick=\"myDrawFunction_Operation1()\">";
				document.getElementById("myDiv17").innerHTML = myHtml;

				YAHOO.util.Dom.setX(myDiv18,myButton_x + 40); 
				YAHOO.util.Dom.setY(myDiv18,myPos_y0 + myBase_y); 
				var myHtml = "<input type=\"button\" value=\"変化\" onClick=\"myDrawFunction_Operation3()\">";
				document.getElementById("myDiv18").innerHTML = myHtml;

				YAHOO.util.Dom.setX(myDiv19,myButton_x + 80); 
				YAHOO.util.Dom.setY(myDiv19,myPos_y0 + myBase_y); 
				var myHtml = "<input type=\"button\" value=\"ﾘｾｯﾄ\" onClick=\"myDrawFunction_Operation4()\">";
				document.getElementById("myDiv19").innerHTML = myHtml;
			//}
		}
	}
}
//操作１　ｽﾄｯﾌﾟ
function myDrawFunction_Operation1()
{
	if (my_Demo_mode == true ) {
		clearTimeout(myTimeout1);
		var myHtml = "<input type=\"button\" value=\"再開\" onClick=\"myDrawFunction_Operation2()\">"
		document.getElementById("myDiv17").innerHTML = myHtml;
	}
	else if (my_Drama_mode == true) {
		clearTimeout(myTimeout1);
		var myHtml = "<input type=\"button\" Style=\"width:60px;height:30px;\" value=\"再開\" onClick=\"myDrawFunction_Operation2()\">"
		document.getElementById("myDiv17").innerHTML = myHtml;
	}
}
//操作２　再開
function myDrawFunction_Operation2()
{
	if (my_Demo_mode == true ) {
		myTimeout1 = setTimeout("myDrawFunction_main()",myInterval_sec);
		var myHtml = "<input type=\"button\" value=\"Stop\" onClick=\"myDrawFunction_Operation1()\">"
		document.getElementById("myDiv17").innerHTML = myHtml;
	}
	else if (my_Drama_mode == true) {
		myTimeout1 = setTimeout("myDrawFunction_main()",myInterval_sec);
		var myHtml = "<input type=\"button\" Style=\"width:60px;height:30px;\" value=\"Stop\" onClick=\"myDrawFunction_Operation1()\">"
		document.getElementById("myDiv17").innerHTML = myHtml;
	}
}
//操作３　変化
function myDrawFunction_Operation3()
{
	jg16.clear();	//せりふ

	if ((parseInt(Math.random() * 5)) % 2 == 0) {
		var my_per1	= 1 - (parseInt(Math.random() * 5)) / 10;
	}
	else {
		var my_per1	= 1 + (parseInt(Math.random() * 5)) / 10;
	}
	myHead_width_per	= 1 * my_per1;	//頭


	my_per1			= 1 + (parseInt(Math.random() * 4)) / 10;
	myHead_height_per	= 0.7 * my_per1;	//頭

	myHead_height	= myHead_width * myHead_height_per;//頭

	my_per1			= 1 - (1 + parseInt(Math.random() * 8)) / 10 + 0.2;
	myBody_width_per	= 1 * my_per1;	//ボディ

	myBody_height_per	= 0.5;	//ボディ
	myLeg_per		= 0.9;//脚
	myPantu_per 		= 1 / 3;//パンツ
	myHair_height_per	= 1 / 8;//髪
	myHair_height	= myHead_height * myHair_height_per;//髪
	myLear_width_per	= 1 / 5;//耳
	myLear_height_per	= 1 / 1;//耳
	myRear_width_per	= 1 / 5;//耳
	myRear_height_per	= 1 / 1;//耳

	my_per1			= 1 + (parseInt(Math.random() * 8)) / 10 - 0.2;
	myEye_height_per	= 1 / 12 * my_per1;//目

	my_per1			= 1 + (parseInt(Math.random() * 8)) / 10 - 0.2;
	myEye_width_per		= 1 / 8 * my_per1;//目


	my_per1			= 1 + (parseInt(Math.random() * 10)) / 10;
	myHitomi_height_per	= 1 / 3 * my_per1;//瞳
	myHitomi_width_per	= 1 / 3 * my_per1;//瞳



	myNose_width_per	= 1 / 10 ;//鼻
	myNose_height_per	= 8 / 10;//鼻
	myNose_y_position	= 1.2 / 2;//鼻

	if ((parseInt(Math.random() * 5)) % 2 == 0) {
		my_per1	= 1 + (parseInt(Math.random() * 2)) / 10;
	}
	else {
		my_per1	= 1 - (parseInt(Math.random() * 9)) / 10;
	}
	myMouse_width_per	= 8 / 10 * my_per1;//口

	if ((parseInt(Math.random() * 5)) % 2 == 0) {
		my_per1	= 1 + (parseInt(Math.random() * 5)) / 10;
	}
	else {
		my_per1	= 1 - (parseInt(Math.random() * 6)) / 10;
	}
	myMouse_height_per	= 1 / 5 * my_per1;//口

	var myHtml = "<input type=\"button\" value=\"変化\" onClick=\"myDrawFunction_Operation3()\">"
	document.getElementById("myDiv18").innerHTML = myHtml;
}
//操作４ 始めから
function myDrawFunction_Operation4() {

	myDrawFunction_value_clear();	//値初期化

	clearTimeout(myTimeout1);
	myTimeout1 = setTimeout("myDrawFunction_main()",myInterval_sec);


}

//運命ドラマ　背景
function myDrawFunction_unmei2()
{
	myCount5++;
	if (my_Demo_mode == true ) {
		if (myCount5 == 1) {
			jg21.clear();
			YAHOO.util.Dom.setX(myDiv21,myPos_x0); 
			YAHOO.util.Dom.setY(myDiv21,myPos_y0); 

			switch (parseInt(Math.random() * 3)) {
			case 0:
				jg21.drawImage("../js/images/takashima1.jpg", myHaikei_x, myHaikei_y, myHaikei_width, myHaikei_height);
				;break;
			case 1:
				jg21.drawImage("../js/images/c008.jpg", myHaikei_x, myHaikei_y, myHaikei_width, myHaikei_height);
				;break;
			case 2:
				jg21.drawImage("../js/images/aso1.jpg", myHaikei_x, myHaikei_y, myHaikei_width, myHaikei_height);
				;break;
			}

		}
	}

}


//ペイント
function myDrawFunction_Paint() {
	myCount8++;
	jg1.paint();
	jg2.paint();
	jg3.paint();
	jg3a.paint();
	jg3b.paint();
	jg4.paint();
	jg4a.paint();
	jg4b.paint();
	jg5.paint();
	jg6.paint();
	jg7.paint();
	jg7a.paint();
	jg7b.paint();
	jg8.paint();
	jg8a.paint();
	jg8b.paint();
	jg9.paint();
	jg10.paint();
	jg11.paint();
	jg12.paint();
	jg13.paint();
	jg14.paint();
	jg15.paint();
	jg16.paint();
	jg17.paint();
	jg18.paint();
	jg19.paint();

	jg21.paint();




}
//重なり順序
function myDrawFunction_Zindex()
{
	my_Div1.style.zIndex = 3;	//ヘッド
	my_Div2.style.zIndex = 3;	//ボディ
	my_Div3.style.zIndex = 10;	//左目
	my_Div3a.style.zIndex = 10;	//左瞳
	my_Div3b.style.zIndex = 11;	//左眉
	my_Div4.style.zIndex = 10;	//右目
	my_Div4a.style.zIndex = 10;	//右瞳
	my_Div4b.style.zIndex = 11;	//右眉
	my_Div5.style.zIndex = 11;	//鼻
	my_Div6.style.zIndex = 6;	//口
	my_Div7.style.zIndex = 7;	//左肩
	my_Div7a.style.zIndex = 7;	//左腕
	my_Div7b.style.zIndex = 6;	//左手
	my_Div8.style.zIndex = 8;	//右肩
	my_Div8a.style.zIndex = 8;	//右腕
	my_Div8b.style.zIndex = 7;	//右手
	my_Div9.style.zIndex = 11;	//左脚
	my_Div10.style.zIndex = 11;	//右脚
	my_Div11.style.zIndex = 10;	//左足
	my_Div12.style.zIndex = 10;	//右足
	my_Div13.style.zIndex = 4;	//首
	my_Div14.style.zIndex = 5;	//蝶ネクタイ
	my_Div15.style.zIndex = 16;	//せりふ窓
	my_Div16.style.zIndex = 17;	//せりふ
	my_Div17.style.zIndex = 14;	//ボタン
	my_Div18.style.zIndex = 14;	//ボタン
	my_Div19.style.zIndex = 14;	//ボタン
	my_Div20.style.zIndex = 15;	//見出し
	my_Div21.style.zIndex = 1;	//背景



}

function myDivWrite() {
	document.write('<div id="myDiv1" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv2" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv3" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv3a" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv3b" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv4" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv4a" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv4b" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv5" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv6" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv7" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv7a" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv7b" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv8" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv8a" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv8b" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv9" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv10" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv11" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv12" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv13" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv14" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv15" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv16" style="position:absolute;width:0px;height:0px;font-size:3px;background: "></div>');
	document.write('<div id="myDiv17" style="position:absolute;width:150px;height:20px;font-size:10px;background:;text-align:left; "></div>');
	document.write('<div id="myDiv18" style="position:absolute;width:150px;height:20px;font-size:10px;background:;text-align:left; "></div>');
	document.write('<div id="myDiv19" style="position:absolute;width:150px;height:20px;font-size:10px;background:;text-align:left; "></div>');
	document.write('<div id="myDiv20" style="position:absolute;width:0px;height:0px;font-size:10px;background: "></div>');
	document.write('<div id="myDiv21" style="position:absolute;width:0px;height:0px;font-size:10px;background: "></div>');

}


myDivWrite();

var my_Div1	= document.getElementById("myDiv1");
var jg1		= new jsGraphics(my_Div1);
var my_Div2	= document.getElementById("myDiv2");
var jg2		= new jsGraphics(my_Div2);
var my_Div3	= document.getElementById("myDiv3");
var jg3		= new jsGraphics(my_Div3);
var my_Div3a	= document.getElementById("myDiv3a");
var jg3a	= new jsGraphics(my_Div3a);
var my_Div3b	= document.getElementById("myDiv3b");
var jg3b	= new jsGraphics(my_Div3b);
var my_Div4	= document.getElementById("myDiv4");
var jg4		= new jsGraphics(my_Div4);
var my_Div4a	= document.getElementById("myDiv4a");
var jg4a	= new jsGraphics(my_Div4a);
var my_Div4b	= document.getElementById("myDiv4b");
var jg4b	= new jsGraphics(my_Div4b);
var my_Div5	= document.getElementById("myDiv5");
var jg5		= new jsGraphics(my_Div5);
var my_Div6	= document.getElementById("myDiv6");
var jg6		= new jsGraphics(my_Div6);
var my_Div7	= document.getElementById("myDiv7");
var jg7		= new jsGraphics(my_Div7);
var my_Div7a	= document.getElementById("myDiv7a");
var jg7a	= new jsGraphics(my_Div7a);
var my_Div7b	= document.getElementById("myDiv7b");
var jg7b	= new jsGraphics(my_Div7b);
var my_Div8	= document.getElementById("myDiv8");
var jg8		= new jsGraphics(my_Div8);
var my_Div8a	= document.getElementById("myDiv8a");
var jg8a	= new jsGraphics(my_Div8a);
var my_Div8b	= document.getElementById("myDiv8b");
var jg8b	= new jsGraphics(my_Div8b);
var my_Div9	= document.getElementById("myDiv9");
var jg9		= new jsGraphics(my_Div9);
var my_Div10	= document.getElementById("myDiv10");
var jg10	= new jsGraphics(my_Div10);
var my_Div11	= document.getElementById("myDiv11");
var jg11	= new jsGraphics(my_Div11);
var my_Div12	= document.getElementById("myDiv12");
var jg12	= new jsGraphics(my_Div12);
var my_Div13	= document.getElementById("myDiv13");
var jg13	= new jsGraphics(my_Div13);
var my_Div14	= document.getElementById("myDiv14");
var jg14	= new jsGraphics(my_Div14);
var my_Div15	= document.getElementById("myDiv15");
var jg15	= new jsGraphics(my_Div15);
var my_Div16	= document.getElementById("myDiv16");
var jg16	= new jsGraphics(my_Div16);
var my_Div17	= document.getElementById("myDiv17");
var jg17	= new jsGraphics(my_Div17);
var my_Div18	= document.getElementById("myDiv18");
var jg18	= new jsGraphics(my_Div18);
var my_Div19	= document.getElementById("myDiv19");
var jg19	= new jsGraphics(my_Div19);
var my_Div20	= document.getElementById("myDiv20");
var jg20	= new jsGraphics(my_Div20);
var my_Div21	= document.getElementById("myDiv21");
var jg21	= new jsGraphics(my_Div21);


var	myCount1	= 0;	//主処理通しｶｳﾝﾄ
var	myW_sec		= 500;	//秒
var	myInterval_sec	= myW_sec * 1.0;//間隔
var	my_Demo_mode	= true;//デモモード真偽
var	my_Drama_mode	= false;//ドラマモード真偽





function myDrawFunction_value_clear() {
	my_ix		= 0;
	myLleg_ix	= 0;
	myRleg_ix	= 0;
	myPantu_ix	= 0;
	myCount2	= 0; //MAX後のｶｳﾝﾄ
	myCount3	= 0; //せりふｶｳﾝﾄ
	myCount3a	= 0; //せりふｶｳﾝﾄ
	myCount4	= 0; //名前
	myCount5	= 0; //背景
	myCount6	= 0; //足元
	myCount7	= 0; //腕
	myCount8	= 0; //ペイント
	myCount9	= 0; //せりふｶｳﾝﾄ
	myCount10	= -1; //歳運
	myCount11	= 0; //歳運空亡
	myCount12	= 0; //天気
	myCount13	= 0; //ボタン

	my_Bmode_hair	= 0; //0ランダム
	my_Bmode_eye	= 0; //0ランダム
	my_Bmode_braw	= 0; //0ランダム
	my_Bmode_mouse	= 0; //0ランダム
	my_Bmode_Larm	= 0; //0ランダム
	my_Bmode_Rarm	= 0; //0ランダム
	my_Bmode_Lleg	= 0; //0ランダム
	my_Bmode_Rleg	= 0; //0ランダム
	my_Bmode_mado	= 0; //0ランダム
	my_Bmode_serifumado	= 0; //0ランダム
	my_Bmode_serifu	= 0; //0ランダム
	my_Bmode_daiun	= 0;
	my_Bmode_saiun	= 0;
	my_ransu_hair	= 0;
	my_ransu_eye	= 0;
	my_ransu_braw	= 0;
	my_ransu_mouse	= 0;
	my_ransu_Larm	= 0;
	my_ransu_Rarm	= 0;
	my_ransu_Lleg	= 0;
	my_ransu_Rleg	= 0;
	my_ransu_mado	= 0;
	my_ransu_serifu	= 0;


	myBody_width_per	= 1;	//ボディ
	myBody_height_per	= 0.5;	//ボディ
	myLeg_per		= 0.9;//脚
	myBairitu 	  	= 1;//パンツ倍率
	myBairitu_leg 		= 1 * myLeg_per;//脚倍率
	myPantu_per 		= 1 / 3;//パンツ
	myHair_height_per	= 1 / 8;//髪
	myLear_width_per	= 1 / 5;//耳
	myLear_height_per	= 1 / 1;//耳
	myRear_width_per	= 1 / 5;//耳
	myRear_height_per	= 1 / 1;//耳
	myEye_height_per	= 1 / 12;//目
	myEye_width_per		= 1 / 8;//目
	myHitomi_height_per	= 1 / 3;//瞳
	myHitomi_width_per	= 1 / 3;//瞳
	myNose_width_per	= 1 / 10;//鼻
	myNose_height_per	= 8 / 10;//鼻
	myNose_y_position	= 1.2 / 2;//鼻
	myMouse_width_per	= 8 / 10;//口
	myMouse_height_per	= 1 / 5;//口


	if (my_Demo_mode == true) {
		myBase_x		= 0;	//ベース
		myBase_y		= 150;	//ベース
		myBase_width_min	= 20;	//ベース
		myBase_width_max	= 100;	//ベース
		myBase_width		= 0;	//ベース
		myBase_width_incl	= 10;	//ベース
		myBase_width_add	= 0;	//ベース
		myBase_height		= 0;	//ベース
		myHaikei_width		= myBase_y * 1.0;//背景
		myHaikei_height		= myBase_y;//背景
		myHaikei_x		= 0 - myHaikei_width / 2;//背景
		myHaikei_y		= 0;	//背景
		myHead_width		= 0;	//頭
		myHead_x		= 0;	//頭
		myHead_y		= 0;	//頭
		myHead_width_per	= 1;	//頭
		myHead_height_per	= 0.7;	//頭
		myHead_height		= myHead_width * myHead_height_per;//頭
		mySerifu_stcnt		= 2;	//せりふ
		mySerifu_dispcnt	= 4;	//せりふ
	}
	myHair_height		= myHead_height * myHair_height_per;//髪



}


//初期処理
function myDrawFunction_init() {
	//開始位置
	myPos_x0 	= YAHOO.util.Dom.getX(myDiv);
	myPos_y0	= YAHOO.util.Dom.getY(myDiv); 

	if (myCount1 == 1) {
		myDrawFunction_value_clear();//値初期化
	}
	my_Bmode_serifumado	= 0;	//せりふ窓モード
	my_Bmode_serifu		= 0;	//せりふモード
	my_Bmode_Lleg		= 0;	//左脚モード
	my_Bmode_Rleg		= 0;	//右脚モード
	//my_Bmode_daiun	= 0;	//大運モード
	my_Bmode_saiun		= 0;	//歳運モード
	//サイズ
	if (myBase_width >= myBase_width_max) {
		myHead_width	= myBase_width_max;
		my_Midasi_mode	= 1;	//見出しモード
		my_Bmode_Lleg	= 1;	//左脚モード
		my_Bmode_Rleg	= 1;	//右脚モード
		my_ransu_Lleg	= -99;	//左脚乱数
		my_ransu_Rleg	= -99;	//右足乱数

		myCount2++;

		if (myCount2 > mySerifu_stcnt) {
			my_Bmode_daiun		= 1;	//大運モード
			my_Bmode_saiun		= 1;	//歳運モード
			my_Bmode_serifumado	= 1;	//せりふ窓モード
			my_Bmode_serifu		= 1;	//せりふモード
			myCount9++;
		}
		if (myCount2 >= (mySerifu_stcnt + mySerifu_dispcnt)) {
			myCount2 = 0;
			myCount9 = 0;
		}
	}
	else {
		my_Midasi_mode	= 0;	//見出しモード
		myBase_width_add= myBase_width_add + myBase_width_incl;
		myBase_width	= myBase_width_min + myBase_width_add;
	}

	myHead_width	= myBase_width * myHead_width_per;
	myBody_width	= myBase_width * myBody_width_per;

	myHead_height	= myBase_width * myHead_height_per;
	myBody_height	= myBase_width * myBody_height_per;
	myHair_height	= myHead_height * myHair_height_per;

	myLleg_width	= (myBody_width / 3) * 0.9 * myBairitu_leg;
	myLleg_height	= (myBody_height / 3.5) * 1.1;
	myLfoot_width	= myLleg_width;
	myLfoot_height	= myLfoot_width / 2;


	myPos_x 	= myPos_x0 - myHead_width / 2;
	myTall_height	= myHead_height + myBody_height + myLleg_height + myLfoot_height / 2;//身長
	if (my_Demo_mode == true) {
		myPos_y		= myPos_y0 + myBase_y - myTall_height;
	}

}

//主処理
function myDrawFunction_main() {
	myCount1++; 
	myDrawFunction_init();	//初期処理
	myDrawFunction_head();	//ヘッド

	myDrawFunction_body();	//ボディ
	myDrawFunction_eye();	//目
	myDrawFunction_nose();	//鼻
	myDrawFunction_mouse();	//口
	myDrawFunction_Larm();	//左腕
	myDrawFunction_Rarm();	//右腕
	myDrawFunction_Lleg();	//左脚
	myDrawFunction_Rleg();	//右脚
	myDrawFunction_Kubi();	//首
	myDrawFunction_Necktie();	//蝶ネクタイ
	myDrawFunction_Serifumado();	//せりふ窓
	myDrawFunction_Serifu();	//せりふ
	myDrawFunction_Button();	//ボタン
	myDrawFunction_Zindex();	//重なり順序
	myDrawFunction_unmei2();	//背景

	myDrawFunction_Paint();		//ペイント

	myTimeout1 = setTimeout("myDrawFunction_main()",myInterval_sec);
	if (myCount10 == 121) {
		clearTimeout(myTimeout1);
	}

}
//開始位置
window.onload = function myDrawFunction_load(){
	//要素test4へonclickイベントをセットする
	//document.form4.test4.onclick = function (){
	//  alert('HTMLから切り離されました')
	//}
	myTimeout1	= setTimeout("myDrawFunction_main()",myInterval_sec);
} 
