window.onresize = resizeCheck;

//アクセス解析
var a_vars = Array();
var pagename='';
var phpmyvisitesSite = 1;
var phpmyvisitesURL = "http://happy-movie.jp/phpmv2_access/phpmyvisites.php";
var get = new Object();


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-17758885-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();



//アフィリエイト用セッション関数
function sesstion(){
	if(location.search.length > 1) {
		var ret = location.search.substr(1).split("&");
		for(var i = 0; i < ret.length; i++) {
			var r = ret[i].split("=");
			get[r[0]] = r[1];
		}
	}else{
		if(getCookie("id") != ""){
			get['id'] = getCookie("id");
		}else{
			get['id'] = 1;
		}
	}
	setCookie("id",get['id']);
}


function getCookie(key){
    tmp = document.cookie+";";
    tmp1 = tmp.indexOf(key,0);
    if(tmp1 != -1){
        tmp = tmp.substring(tmp1,tmp.length);
        start = tmp.indexOf("=",0);
        end = tmp.indexOf(";",start);
        return(unescape(tmp.substring(start+1,end)));
    }
    return("");
}


function setCookie(key,val){
    tmp = key+"="+escape(val)+";";
    document.cookie = tmp;
}


//init兼IE6PNG対策
function forIE6(){
	var h = Math.max( document.body.clientHeight , document.body.scrollHeight );   
	h = Math.max( h , document.documentElement.scrollHeight );   
	h = Math.max( h , document.documentElement.clientHeight );
	document.getElementById("buckleft").style.top = h - 80 + "px";
	document.getElementById("buck").style.height = h + 67 +  "px";
	if (typeof document.body.style.maxHeight == "undefined") {
		//IE６対応
		DD_belatedPNG.createVmlNameSpace();
		DD_belatedPNG.createVmlStyleSheet();
		DD_belatedPNG.fix('img#buckright');
		DD_belatedPNG.fix('div#triangle');
		DD_belatedPNG.fix('div#maincontents div');
		DD_belatedPNG.fix('div#maincontents img');
		DD_belatedPNG.fix('div#maincontents_2 div');
		DD_belatedPNG.fix('div#maincontents_2 img');
		DD_belatedPNG.fix('div#maincontents_3 div');
		DD_belatedPNG.fix('div#maincontents_3 img');
	}
	//ゲットデータ取得
	sesstion();
}


function forIE6plus(name){
	sample_start(name);
	forIE6();
}


function manualresize(h){
	document.getElementById("buckleft").style.top = h - 100 + "px";
	document.getElementById("buck").style.height = h + 47 +  "px";
}


//リサイズ
function resizeCheck(myEvents){
	
	var w = Math.max( document.documentElement.clientWidth , document.body.clientWidth );   
	w = Math.max( w , document.documentElement.clientWidth );   
	w = Math.max( w , document.body.clientWidth );
	if(w > 830){
		document.getElementById("buck").style.width = "100%";
		if (typeof document.body.style.maxHeight == "undefined") {
			//IE６対応
			document.getElementById("buck").style.width = "101.5%";
		}
		document.getElementById("buckright").style.right = "0px";
		document.getElementById("buckright").style.left = null;
	}else{
		document.getElementById("buck").style.width = "830px";
		document.getElementById("buckright").style.right = null;
		document.getElementById("buckright").style.left = "523px";
	}
}


function toollinkwrite(){
	//document.open();
	//document.write("<a href=\"https://sv81.wadax.ne.jp/~movie-station-com/products/happy-movie/app/MovieMaker/connector.php?id=" + getCookie("id") + "\" target=\"_blank\">");
	//document.close();
}

function setlink(){
	//document.getElementById("afiri").setAttribute("href" , "\"https://sv81.wadax.ne.jp/~movie-station-com/products/happy-movie/app/MovieMaker/connector.php?id=" + getCookie("id") + "\"");
	window.open("https://sv81.wadax.ne.jp/~movie-station-com/products/happy-movie/app/MovieMaker/connector.php?id=" + get['id']);
}

var switcher = 0;

//メニューのマウスオーバーアイコン変更
function iconchange(id){
	if(switcher == 0){
		var fromsrc = document.getElementById(id).src;
		document.getElementById(id).src = fromsrc.split(".png")[0] + "_.png";
		switcher = 1;
	}
}

//メニューのマウスアウト変更
function iconreturn(id){
    var fromsrc = document.getElementById(id).src;
	document.getElementById(id).src = fromsrc.split("_.png")[0] + ".png";
	switcher = 0;
}

//メニューのマウスオーバーアイコン変更(質問)
function iconchange_question(id){
    document.getElementById("onbord"+id).style.background="url(img/question/onbord"+id+"_.png)";
}

//メニューのマウスアウト変更(質問)
function iconreturn_question(id){
    document.getElementById("onbord"+id).style.background="url(img/question/onbord"+id+".png)";
}

function question_click(id , name ,h){
	document.getElementById("pencil").style.background="url(img/question/pencil"+ id +".png)";
	if(document.getElementById){
		if(document.getElementById(name).style.display == "block"){
		  //document.getElementById(id).style.display = "none";
		}else{
		  document.getElementById("about_happy").style.display = "none";
		  document.getElementById("about_seisaku").style.display = "none";
		  document.getElementById("about_price").style.display = "none";
		  document.getElementById("about_returne").style.display = "none";
		  document.getElementById("about_pc").style.display = "none";
		  document.getElementById(name).style.display = "block";
		}
  	}
	forIE6();
	manualresize(h);
}

//サンプルメニュークリック時
function sample_start(name){
	document["happysamplemovie"].setmovie("https://sv81.wadax.ne.jp/~movie-station-com/sampleflv/"+name+".flv");
}

var vol = 0;


function vol_roll(){
	num = vol*4;
	document.getElementById("volbuttonimg").src = "../img/movie/vol" +  String(num) + "_.png";
}

function vol_over(){
	num = vol*4;
	document.getElementById("volbuttonimg").src = "../img/movie/vol" +  String(num) + ".png";
}

function volume_change(){
	vol += 0.25;
	if(vol==1){
		vol=0;
	}
	document["happysamplemovie"].setvolume(vol);
	num = vol*4;
	document.getElementById("volbuttonimg").src = "../img/movie/vol" +  String(num) + "_.png";
}



