function clearsearch() {
  document.getElementById("searchinput").value = "";
}

function showchtrm(id, sponsor){

	var allx = [];
	allx = document.getElementsByClassName('camwindow');
	for(i=0;i<allx.length;i++){
		z=allx[i].id;
		document.getElementById(z).style.display="none";
	}

	qx = document.getElementById('cambox');
	qx.style.display="block";
	qx.style.top=(window.pageYOffset) + "px";
if (sponsor == 'stripchat') {

	var plyfacts = [];
	plyfacts = id.split("|");

	qx.innerHTML='<div class=\"chtrm_closebutton\" onclick=\"closechtrm();\" style=\"\">X</div>'+
'<div id="camplayer" class="camplayerbox"><canvas id="canvas" class="stripchat_player"></canvas><a href="https://go.stripchat.com/?userId=' + '<?php echo $stripchat_id; ?>' + '&path=/' + plyfacts[4] + 
'"> <button class="playbutton1">Chat With This Model</button></a></div>';

	startpl(plyfacts[3], plyfacts[2], plyfacts[1]);

}else if (sponsor == 'cams') {

	qx.innerHTML='<div class=\"chtrm_closebutton\" onclick=\"closechtrm();\" style=\"\">X</div><iframe width=600 height=500 src="https://banners.cams.com/banners/streamray/live/banner.html?pid=g248918-pmob&cib=1&w=600&h=400&l=https%3A%2F%2Fsecureimage.securedataimages.com%2Fimages%2Fcams%2Fbanners%2Fmicro_logo_new.png&d=https%3A%2F%2Fsecure.cams.com%2Fgo%2Fpage%2Fcams%2Fview.cgi%3Fpid%3Dg248918-pmob%26stream%3D%7bstream%7d%26action%3Dview&g=F&v=0&c=1&m=&md=any&cb=cams.com" scrolling="yes" frameBorder="0" id="camsLiveBanner"></iframe>';
}else if (sponsor == 'movies') {
	qx.innerHTML="<div class=\"chtrm_closebutton\" onclick=\"closechtrm();\" style=\"\">X</div><video width=\"100%\"  controls poster=\"poster\" >  <source src=\"" + id + "\" type=\"video/mp4\"></video>";


}else {

	qx.innerHTML="<div class=\"chtrm_closebutton\" onclick=\"closechtrm();\" style=\"\">X</div><iframe width=\"100%\" height=\"100%\"  src='" + id + "' ></iframe>";

}
	var ovlay = document.getElementById('screen_overlay');
	ovlay.style.display="block";
	ovlay.style.position="fixed";
	ovlay.style.top="0px";
	ovlay.style.left="0px";
	ovlay.style.background="rgba(0,0,0,.8)";
	ovlay.style.boxSizing="border-box";
	ovlay.style.zIndex="2";
	ovlay.style.width="100%";
	ovlay.style.height="100%";
}


function showmovie(id, poster, sponsor, sitelink){

	var allx = [];
	allx = document.getElementsByClassName('camwindow');
	for(i=0;i<allx.length;i++){
		z=allx[i].id;
		document.getElementById(z).style.display="none";
	}

	qx = document.getElementById('cambox');
	qx.style.display="block";
	qx.style.top=(window.pageYOffset) + "px";

	qx.innerHTML="<div class=\"chtrm_closebutton\" onclick=\"closechtrm();\" style=\"\">X</div><div class=videojoinlink><a class=joinhref href=\""+sitelink+"\">Join "+sponsor+"</a></div><video width=\"100%\"  controls poster=\"" + poster + "\" >  <source src=\"" + id + "\" type=\"video/mp4\"></video>";



	var ovlay = document.getElementById('screen_overlay');
	ovlay.style.display="block";
	ovlay.style.position="fixed";
	ovlay.style.top="0px";
	ovlay.style.left="0px";
	ovlay.style.background="rgba(0,0,0,.8)";
	ovlay.style.boxSizing="border-box";
	ovlay.style.zIndex="2";
	ovlay.style.width="100%";
	ovlay.style.height="100%";
}


function closechtrm() {

	qx = document.getElementById('cambox');
	qx.innerHTML = "";
	qx.style.display="none";

	var ovlay = document.getElementById('screen_overlay');
	ovlay.style.display="none";
	ovlay.style.position="static";
}



  function startpl(model_id, model_token, model_server, model_username) {
	var canvasRef = document.getElementById('canvas');
	var modelId = model_id;
	var modelToken = model_token;
	var modelSnapshotServer = model_server;
	var model_username = model_username;
	var player;

    player = new StripchatPlayer();
      player.setCanvasRef(canvasRef);
      player.setModelId(modelId);
      player.setModelToken(modelToken);
      player.setModelSnapshotServer(modelSnapshotServer);
      player.mount();
  }
  

	xtog = 0;
	function togmobilenav() {
		if(xtog == 0){
			xtog = 1;
			t=document.getElementById('toplinkscont').innerHTML;
			document.getElementById('mobilemenucont').innerHTML = t+"<br>";
			document.getElementById('mobilemenucont').className="mobilemenudisplay";
		} else {
			xtog = 0;
			document.getElementById('mobilemenucont').innerHTML = "";
			document.getElementById('mobilemenucont').className="mobilemenucont";
		}

	}
	var tog_more = 0;
	var sm = [];
	function showmoretoplinks(){
		if (tog_more == 0) {	
			xsw = document.getElementsByClassName('dropdown');
			for(i=0;i<xsw.length;i++){
				xsw[i].style.display="block";
			}
			tog_more=1;
			sm = document.getElementsByClassName('showmore');
			sm[0].innerHTML = "Close &#9652;";
			if(sm.length > 1) {sm[1].innerHTML = "Close &#9652;";}
			
		}else{
			xsw = document.getElementsByClassName('dropdown');
			for(i=0;i<xsw.length;i++){
				xsw[i].style.display="none";
			}				
			tog_more=0;
			sm = document.getElementsByClassName('showmore');
			sm[0].innerHTML = "Search &#9662;";
			if(sm.length > 1) {sm[1].innerHTML = "Search &#9662;";}
			
		}
	

	}		
		
		
		
