$(document).ready(function() {

			   
	$(".rollOver").hover(
						 function()
						 {
						  this.src = this.src.replace("-off","-over");
						 },
						 function()
						 {
						  this.src = this.src.replace("-over","-off");
						 }
						);
	
	$('#hp_video_news').cycle({ 
		fx:     'scrollLeft',
		timeout:	5000
	});
	$('#pane1').jScrollPane({showArrows:true});
	$('#pane2').jScrollPane({showArrows:true});
	$('.hp_video_link').click(function(){ 
									   var videoFile = this.src.replace("thumbnails","media");
									   videoFile = videoFile.replace(".jpg",".flv");
									   var titleName = $(this).attr("alt").replace("App: ","");
									   titleName = titleName.replace("News: ","")+'. <a href="video_blog.php?image_id='+$(this).attr("rel")+'">Learn more &raquo;</a>';
									   $('#hp_video_main').html('<object width="660" height="260"><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" />  <param name="flashvars" value="width=660&height=260&skin=SkinOverAllNoFullNoCaption.swf&skinAutoHide=1&skinFadeTime=1&skinBackgroundColor=0x000000&skinBackgroundAlpha=.2&source='+ videoFile +'" /><param name="allowscriptaccess" value="always" /><param name="base" value="http://www.famousframes.com/hp-player/" /><param name="movie" value="http://www.famousframes.com/hp-player/VideoPlayer.swf" /><embed src="http://www.famousframes.com/hp-player/VideoPlayer.swf" type="application/x-shockwave-flash" allowfullscreen="true" wmode="transparent" flashvars="width=660&height=260&skin=SkinOverAllNoFullNoCaption.swf&skinAutoHide=1&skinFadeTime=1&skinBackgroundColor=0x000000&skinBackgroundAlpha=.2&source='+ videoFile +'" base="http://www.famousframes.com/hp-player/" allowscriptaccess="always" width="660" height="260"></embed>             </object>');
									   $('#hp_video_main_text').html(titleName);
									   });
	$('.hp_app_link').click(function(){ 
									   var videoFile = this.src.replace("thumbnails","media");
									   videoFile = videoFile.replace(".jpg",".flv");
									   $('#hp_video_app').html('<object width="180" height="200"><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" />  <param name="flashvars" value="width=180&height=200&skin=SkinOverAllNoFullNoCaption.swf&skinAutoHide=1&skinFadeTime=1&autoPlay=false&skinBackgroundColor=0x000000&skinBackgroundAlpha=.2&source='+ videoFile +'" />  <param name="allowscriptaccess" value="always" /><param name="base" value="http://www.famousframes.com/hp-player/" /><param name="movie" value="http://www.famousframes.com/hp-player/VideoPlayer.swf" /><embed src="http://www.famousframes.com/hp-player/VideoPlayer.swf" type="application/x-shockwave-flash" allowfullscreen="true" wmode="transparent" flashvars="width=180&height=200&skin=SkinOverAllNoFullNoCaption.swf&skinAutoHide=1&skinFadeTime=1&autoPlay=false&skinBackgroundColor=0x000000&skinBackgroundAlpha=.2&source='+ videoFile +'" base="http://www.famousframes.com/hp-player/" allowscriptaccess="always" width="180" height="200"></embed> </object>');
									  
									   });
	
	// Confirm Submit
	$('.confirm').click(function(){   
			var agree=confirm("This action can not be undone. Are you sure you want to continue?");
			if (agree)
				return true ;
			else
				return false ;
	});
	
	$(function() {
		$('a.enlarge').lightBox();
		
	});
	$('a.enlarge').click(function(){   
		setTimeout(function() { $('#jquery-lightbox').css('top','10px'); }, 1000);
	});
	$(function() {      
	   // initialize scrollable     
	   $("div.scrollable").scrollable({size:1}).navigator({navi:'ul.navipages'});  
	   }); 
		
	$('.rndcorner').corner("5px;");
		
	$('.tooltip2').tooltip({ 
		track: true, 
		delay: 0, 
		fade: 250,
		showURL: false, 
		bodyHandler: function() { 
			imgURL = $(this).attr("rel").replace("url(", "");
			imgURL = imgURL.replace(")", "");
			imgURL = imgURL.replace('"', '');
			imgURL = imgURL.replace('"', '');
			imgURL = imgURL.replace('thumbnails_new', 'media');
			//alert(imgURL);
			return $("<img/>").attr("src", imgURL); 
		} 
	});	
	$('.tooltip').tooltip({ 
		track: true, 
		delay: 0, 
		fade: 250,
		showURL: false, 
		bodyHandler: function() { 
			imgURL = $(this).css("background-image").replace("url(", "");
			imgURL = imgURL.replace(")", "");
			imgURL = imgURL.replace('"', '');
			imgURL = imgURL.replace('"', '');
			imgURL = imgURL.replace('thumbnails_new', 'media');
			//alert(imgURL);
			return $("<img/>").attr("src", imgURL); 
		} 
	});	
		
	
});
 var captcha_reload_count = 0;
	var captcha_image_url = "{url_captcha_image}";
  function new_captcha_image() {
    if (captcha_image_url.indexOf('?') == -1) {
		  document.getElementById('captcha_image').src= captcha_image_url+'?c='+captcha_reload_count;
		} else {
		  document.getElementById('captcha_image').src= captcha_image_url+'&c='+captcha_reload_count;
		}

    document.getElementById('captcha_input').value="";
    document.getElementById('captcha_input').focus();
    captcha_reload_count++;
  }

	function opendetailwindow() { 
    window.open('','detailwindow','toolbar=no,scrollbars=yes,resizable=no,width=680,height=480');
  }
  
 // function right(e) {
 //   if ((document.layers || (document.getElementById && !document.all)) && (e.which == 2 || e.which == 3)) {
 //     alert("© Copyright by {site_name}");
 //     return false;
 //   }
 //   else if (event.button == 2 || event.button == 3) {
 //     alert("© Copyright by {site_name}");
 //     return false;
 //   }
 //   return true;
 // }

 // if (document.layers){
 //   document.captureEvents(Event.MOUSEDOWN);
 //   document.onmousedown = right;
 // }
 // else if (document.all && !document.getElementById){
 //   document.onmousedown = right;
 // }

 // document.oncontextmenu = new Function("alert('© Copyright by {site_name}');return false");

function switchDiv(elementId, bolVisible) {
	if( document.getElementById ) { var theElement = document.getElementById(elementId); } else {
	if( document.all ) { var theElement = document.all[ elementId ]; } else { var theElement = new Object(); } }
	if( !theElement ) { return; }
	if( theElement.style ) { theElement = theElement.style; }
	if( typeof( theElement.display ) == 'undefined' && !( window.ScriptEngine && ScriptEngine().indexOf( 'InScript' ) + 1 ) ) { window.alert( 'Hidden navigation will not work in this browser, for more information please contact support@kayako.com' ); return; }
	if (bolVisible == true) {
		theElement.display = 'block';
	} else {
		theElement.display = 'none';
	}
}

function ShowElement(id) {
	switchDiv(id,true);
}

function HideElement(id) {
	switchDiv(id,false);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
function Change_Borders(bcolor) {
	MM_changeProp('border1','','style.backgroundColor',bcolor,'TD');
	MM_changeProp('border2','','style.backgroundColor',bcolor,'TD');
	MM_changeProp('border3','','style.backgroundColor',bcolor,'TD');
}
function Check_Box(cat_id) {
	switchDiv('checkbox_off'+cat_id, false); 
	switchDiv('checkbox_on'+cat_id, true);
	var catFiled = document.category_search["cat_id["+cat_id+"]"];
	eval("catFiled.value="+cat_id);
}
function unCheck_Box(cat_id) {
	switchDiv('checkbox_on'+cat_id, false);
	switchDiv('checkbox_off'+cat_id, true); 
	var catFiled = document.category_search["cat_id["+cat_id+"]"];
	eval("catFiled.value=");
	//document.forms.category_search.cat_id[cat_id].value="";
	//document.category_search.cat_id['"+cat_id+"'].value=");
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


