// JavaScript Document
function buttondown(buttonname){
	document.getElementById('button_'+buttonname).src='sites/all/themes/mind/images/menu/'+buttonname+'_ov.jpg';
}
function buttonup ( buttonname ){
   document.getElementById('button_'+buttonname).src='sites/all/themes/mind/images/menu/'+buttonname+'.jpg';
}
function buttondown_el(buttonname){
	document.getElementById('button_'+buttonname).src='sites/all/themes/mind/images/menu/gr/'+buttonname+'_ov.jpg';
}
function buttonup_el( buttonname ){
   document.getElementById('button_'+buttonname).src='sites/all/themes/mind/images/menu/gr/'+buttonname+'.jpg';
}
var visible=false;
var slidespeed=400;


$(document).ready(
	function(){
			$(".view-id-Portfolio .views-row-odd").each(
				function(i){
						var href=$(this).find('.views-field-title a').attr('onclick');
						$(this).bind('click',href);
				}
			);
			$(".view-id-Portfolio .views-row-even").each(
				function(i){
						var href=$(this).find('.views-field-title a').attr('onclick');
						$(this).bind('click',href);
				}
			);					
	}
/*	function(){
		$("#clients2").hover(
			function () {
				$("#clients").toggle("slide",  { direction: "down" }, slidespeed)
				}
				,
			function () {
				;
				}
			);*/
/*			function () {
				$("#clients").hide("slide",  { direction: "down" }, slidespeed)
				}
			);*/
		/*$("#clients").mouseover(
			function () {
				$("#clients").show("slide",  { direction: "down" }, slidespeed)
				}
		);*/
/*		$("#clients").mouseout(
			function () {
				$("#clients").hide("slide",  { direction: "down" }, slidespeed)
				}
		);
	}*/
);
function getQueryVariable(query,variable) {
	var q=query.split("?");
	 var vars;
	if(q.length>1)
		vars = q[1].split("&");
	else
		vars = q[0].split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
}
	function loadvideo(video){
		video_id=getQueryVariable(video,'v');
		var vhtml='<object width="536" height="320"><param name="movie" value="http://www.youtube.com/v/'+video_id+'&hl=en&fs=1&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+video_id+'&hl=en&fs=1&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="536" height="320"></embed></object>';
		vhtml='<object width="536" height="320">   <param name="movie" value="http://www.youtube.com/v/'+video_id+'&hl=en&fs=1&autoplay=1">   </param>   <param name="allowFullScreen" value="true">   </param> <param name="wmode" value="transparent">   </param>  <param name="allowscriptaccess" value="always">   </param>   <embed src="http://www.youtube.com/v/'+video_id+'&hl=en&fs=1&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="536" height="320" wmode="transparent"></embed> </object>';
		//alert(vhtml);
		document.getElementById('video_viewer').innerHTML=vhtml;
		scroll(0,0);
	}
	function getUrlCommand(){
		var strHref = window.location.href;
		var strCommand='';
		if(strHref.indexOf('#') > -1){
			 strCommand = strHref.substr(strHref.indexOf("#")+1);
		}
		return strCommand;
	}
	function getStringCommand(str){
		var strHref = str;
		var strCommand='';
		if(strHref.indexOf('#') > -1){
			 strCommand = strHref.substr(strHref.indexOf("#")+1);
		}
		return strCommand;
	}
	function viewVideo(url){
		var elem=document.getElementById('video_viewer');
		if(elem){
			loadvideo(getStringCommand(url));
		}
		else{
			window.location.href=url;
		}
	}