	
var timeout    = 1200;
var closetimer = 15;
var ddmenuitem = 0; 

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
    ddmenuitem = $(this).find('ul').css('visibility', 'visible');}
 
function jsddm_close()
{ 
 if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
}

function jsddm_timer() 
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)});

document.onclick = jsddm_close;

function sendClientInfo()
{
	if($("#clientName").val() == "")
	{
		alert("Please enter name!");
		return false;
	}

	else if($("#clientPhone").val() == "")
	{
		alert("Please enter at least one phone!");
		return false;
	}
	else if($("#clientType").val() == "none")
	{
		alert("Please choose whether you want to pawn or sell your items!");
		return false;
	}
	else if($("#clientDescription").val() == "")
	{
		alert("Say few words about your item!");
		return false;
	}
	else if( document.getElementById('file_uploadQueue').innerHTML == "")
	{
		$.get("ajax_request.php",{
			c_name:$('#clientName').val(), 
			c_phone:$('#clientPhone').val(),
			c_phone2:$('#clientPhone2').val(),
			c_address:$('#clientAddress').val(),
			c_email:$('#clientEmail').val(),
			c_request:$('#clientRequest').val(),
			c_description:$('#clientDescription').val(),
			c_type:$('#clientType').val(),
			uniqueid:$('#clientSession').val()
			},
		 	function(data) {
			document.getElementById('formArea').innerHTML = "<h3 class=\"goodMessage\">Thank you. We received request from you, we will contact you shortly!</h3>"+data;	
			
 		});		  		
	}else
	{
		$('#file_upload').uploadifyUpload();
	}
}	
// <![CDATA[
$(document).ready(function() {
  $('#file_upload').uploadify({
 'uploader'  : 'uploadify/uploadify.swf', 
    'script'    : 'uploadify.php',
    'cancelImg' : 'uploadify/cancel.png',
    'folder'    : 'upload_tmp',
    'auto'      : false,
 	'displayData' : 'percentage',  
	'fileDataName' : 'Filedata',
	'buttonText'  : 'Add Images', 
	'method'      : 'get', 
	'fileExt'     : '*.jpg;*.gif;*.png;*.doc;*.docx;*.rtf;*.txt;*.wpd;*.wps;*.pdf;*.bmp;*.psd;*.tif;*.yuv;*.ai;*.drw;*.ps;*.svg;*.eps;*.raw;',
	'multi'       : true, 
 	'removeCompleted' : false,
	'onAllComplete' : function(event,data) {


    document.getElementById('formArea').innerHTML = "<h3 class=\"goodMessage\">Thank you. We received "+data.filesUploaded+" file(s) from you, we will contact you shortly!</h3>";  
	},
	'onSelect' : function(){
                //get form values
                //check here if form values are empty.
                $('#file_upload').uploadifySettings('scriptData', {
					'c_name':$('#clientName').val(), 
					'c_phone':$('#clientPhone').val(),
					'c_phone2':$('#clientPhone2').val(),
					'c_address':$('#clientAddress').val(),
					'c_email':$('#clientEmail').val(),
					'c_request':$('#clientRequest').val(),
					'c_description':$('#clientDescription').val(),
					'c_type':$('#clientType').val(),
					'uniqueid':$('#clientSession').val()
					
					}
            )},'onComplete'  : function(event, ID, fileObj, response, data) {
                //document.getElementById('formArea').innerHTML = 'Thank you, we will contact you shortly!';  
            /*	alert(event);
				alert(ID);
				alert(fileObj);
				alert(response);
				alert(data);
			*/}
  });
  FileToUploadUploader=document.getElementById("FileToUploadUploader"); 
}); 

 
$(function()
{ 
	var config = {
		width: 330,   
		toolbar:  
		[
	{ name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','RemoveFormat' ] } ,'/',
	{ name: 'paragraph', items : [ 'NumberedList','BulletedList','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'] },
	{ name: 'colors', items : [ 'TextColor','BGColor' ] } 
]
	};
	$('.describe_item').ckeditor(config);  
	// Initialize the editor.
	// Callback function can be passed and executed after full instance creation.
//	$('.jquery_ckeditor').ckeditor(config);
});

function activateExplanation(explanationID)
{
 $('.explanation').hide(3000);
 $(explanationID).toggle(1200); 
 }

$(function() {
			$('.hover_block div').hover(function(){
				/*$('.imgSteps').animate({height : '150px'},{queue:false,duration:500});   
 				*/$(this).find('img').animate({padding:'10px'},{queue:false,duration:500});
				$(this).find('img').fadeTo('fast', 1 );     
				$(this).find('h2').addClass("vertical");
				$(this).find('img').animate({height : '230px'},{queue:false,duration:500});
				$(this).find('img').animate({position : 'static'},{queue:false,duration:500});
					 
				
			}, function(){ 
				$(this).find('h2').removeClass("vertical");
				$(this).find('img').animate({padding:'5px '},{queue:false,duration:500}); 
 				$(this).find('img').fadeTo('fast', 0.4 );  
				$('.imgSteps').animate({height : '200px'},{queue:false,duration:500});
			});
		});
		
